Browse Source

风速功率预测

xushili 2 years ago
parent
commit
fc675851fd

+ 1 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/decision/WfNwpDataMapper.java

@@ -17,4 +17,5 @@ import java.util.List;
  */
 public interface WfNwpDataMapper extends BaseMapper<WfNwpData> {
     List<WfNwpData> getAllInDate(@Param("winno") short winno, @Param("starttime") Date start, @Param("endtime") Date end);
+    List<WfNwpData> getAllInDate2(@Param("winno") short winno, @Param("starttime") Date start);
 }

+ 248 - 47
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskWindspeedForecast.java

@@ -2,20 +2,23 @@ package com.gyee.impala.schdule;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.impala.common.spring.DecisionConvert;
+import com.gyee.impala.common.util.DateUtil;
 import com.gyee.impala.mapper.decision.*;
-import com.gyee.impala.mapper.master.WindspeedforecastshorttermMapper;
-import com.gyee.impala.mapper.master.WindspeedforecastspshorttermMapper;
 import com.gyee.impala.model.decision.*;
 import com.gyee.impala.model.master.Windspeedforecastshortterm;
 import com.gyee.impala.model.master.Windspeedforecastspshortterm;
 import com.gyee.impala.service.master.IWindspeedforecastshorttermService;
 import com.gyee.impala.service.master.IWindspeedforecastspshorttermService;
 import lombok.SneakyThrows;
+import org.apache.kudu.client.KuduException;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
 import java.util.stream.Collectors;
 
 /**
@@ -74,6 +77,23 @@ public class TaskWindspeedForecast {
     //预测风速
     private List<WfNwpData> wfNwpDatas;
 
+    private List<Windspeedforecastshortterm> windspeedforecastshortterms;
+    private List<Windspeedforecastspshortterm> windspeedforecastspshortterms;
+
+    public List<Windspeedforecastshortterm> getWindspeedforecastshortterms(Date time) {
+        QueryWrapper<Windspeedforecastshortterm> wrapper = new QueryWrapper();
+        wrapper.gt("calctime", time);
+        windspeedforecastshortterms = windspeedforecastshorttermService.list(wrapper);
+        return windspeedforecastshortterms;
+    }
+
+    public List<Windspeedforecastspshortterm> getWindspeedforecastspshortterms(Date time) {
+        QueryWrapper<Windspeedforecastspshortterm> wrapper = new QueryWrapper();
+        wrapper.gt("calctime", time);
+        windspeedforecastspshortterms = windspeedforecastspshorttermService.list(wrapper);
+        return windspeedforecastspshortterms;
+    }
+
     private List<Mv> mvs;
 
     public List<Mv> getMvMap() {
@@ -90,27 +110,41 @@ public class TaskWindspeedForecast {
     //短期
     public void shortTerm() {
         Calendar today = Calendar.getInstance();
-        getWfStatPeriodDatas(today);
-        getWfNwpDatas(today);
-        getNoscaleWfDaPfPeriodDatas(today);
+        Date starttime = getStarttime(today);
+        getWfStatPeriodDatas(starttime);
+        getWfNwpDatas(starttime);
+        getNoscaleWfDaPfPeriodDatas(starttime);
+        getWindspeedforecastshortterms(starttime);
         //获取场站短期风速功率预测
-        List<Windspeedforecastshortterm> windspeedforecastshorttermList1 = getStationWindspeedandpowerForecast();
+        List<Windspeedforecastshortterm> wsfstList1 = getStationWindspeedandpowerForecast();
         getWfYcHistoryData1s(today);
         getWfProjectStatPeriodDatas(today);
         getNoscalePrDaPfPeriodDatas(today);
         //获取期次短期风速功率预测
-        List<Windspeedforecastshortterm> windspeedforecastshorttermList2 = getProjectWindspeedandpowerForecast();
+        List<Windspeedforecastshortterm> wsfstList2 = getProjectWindspeedandpowerForecast();
         getNoscaleCwDaPfPeriodDatas(today);
         //获取集电线路短期风速功率预测
-        List<Windspeedforecastshortterm> windspeedforecastshorttermList3 = getLineWindspeedandpowerForecast();
+        List<Windspeedforecastshortterm> wsfstList3 = getLineWindspeedandpowerForecast();
         getMvMap();
         getNoscaleWtgDaPfPeriodDatas(today);
         //获取风机短期风速功率预测
-        List<Windspeedforecastshortterm> windspeedforecastshorttermList4 = getWindturbineWindspeedandpowerForecast();
-        windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList2);
-        windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList3);
-        windspeedforecastshorttermList1.addAll(windspeedforecastshorttermList4);
-        windspeedforecastshorttermService.insertBatch(windspeedforecastshorttermList1);
+        List<Windspeedforecastshortterm> wsfstList4 = getWindturbineWindspeedandpowerForecast();
+        wsfstList1.addAll(wsfstList2);
+        wsfstList1.addAll(wsfstList3);
+        wsfstList1.addAll(wsfstList4);
+        List<Windspeedforecastshortterm> collect1 = wsfstList1.stream().filter(w -> w.getId() == null).collect(Collectors.toList());
+        List<Windspeedforecastshortterm> collect2 = wsfstList1.stream().filter(w -> w.getId() != null)
+                .map(w->{
+                    Windspeedforecastshortterm wsf = new Windspeedforecastshortterm();
+                    wsf.setId(w.getId());
+                    wsf.setActualpower(w.getActualpower());
+                    wsf.setActualwindspeed(w.getActualwindspeed());
+                    wsf.setForecastpower(w.getForecastpower());
+                    wsf.setForecastwindspeed(w.getForecastwindspeed());
+                    return wsf;
+                }).collect(Collectors.toList());
+        windspeedforecastshorttermService.insertBatch(collect1);
+        windspeedforecastshorttermService.updateBatchById(collect2,300);
     }
 
     private List<Windspeedforecastshortterm> getStationWindspeedandpowerForecast() {
@@ -127,6 +161,7 @@ public class TaskWindspeedForecast {
             wsfcst.setWyfcid(noscaleWfDaPfPeriodData.getWindplantNo());
             wsfcsts.add(wsfcst);
         }
+
         wsfcsts = wsfcsts.stream().map(wct -> {
             wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
                     wct.getCalctime().compareTo(wspd.getDataTime()) == 0).forEach(wspd -> {
@@ -137,6 +172,11 @@ public class TaskWindspeedForecast {
                     wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
                 wct.setForecastwindspeed(wnd.getWindSpeed());
             });
+            windspeedforecastshortterms.stream().filter(wsfst->wct.getStationid().equals(wsfst.getStationid()) &&
+                    wct.getCalctime().equals(wsfst.getCalctime()) &&
+                    wct.getAlgorithmmodel().equals(wsfst.getAlgorithmmodel())).forEach(wsfst->{
+                wct.setId(wsfst.getId());
+            });
             return wct;
         }).collect(Collectors.toList());
 
@@ -302,50 +342,90 @@ public class TaskWindspeedForecast {
     }
 
     @SneakyThrows
-    @Scheduled(cron = "0 55 2 * * ?")
+    //@Scheduled(cron = "0 */30 * * * ?")
     //超短期
     public void specialShortTerm() {
 
         Calendar today = Calendar.getInstance();
-        //getWfStatPeriodDatas(today);
-        //getWfNwpDatas(today);
-        getWfUspTsPeriodDatas(today);
+
+        Date starttime = getThistime(today);
+
+        getWfStatPeriodDatas(starttime);
+        getWfNwpDatas(starttime);
+
+        getWfUspTsPeriodDatas(starttime);
+
+        getWindspeedforecastspshortterms(starttime);
         //获取场站超短期风速功率预测
-        List<Windspeedforecastspshortterm> windspeedforecastspshorttermList1 = getStationWindspeedandpowerForecastSp();
+        List<Windspeedforecastspshortterm> wsfsstList1 = getStationWindspeedandpowerForecastSp();
         //getWfYcHistoryData1s(today);
         //getWfProjectStatPeriodDatas(today);
         //getNoscalePrDaPfPeriodDatas(today);
         getProjectUspTsPeriodDatas(today);
         //获取期次超短期风速功率预测
-        List<Windspeedforecastspshortterm> windspeedforecastspshorttermList2 = getProjectSpWindspeedandpowerForecastSp();
-        windspeedforecastspshorttermList1.addAll(windspeedforecastspshorttermList2);
-        windspeedforecastspshorttermService.insertBatch(windspeedforecastspshorttermList1);
+        List<Windspeedforecastspshortterm> wsfsstList2 = getProjectSpWindspeedandpowerForecastSp();
+        wsfsstList1.addAll(wsfsstList2);
+
+        List<Windspeedforecastspshortterm> collect1 = wsfsstList1.stream().filter(w -> w.getId() == null).collect(Collectors.toList());
+        List<Windspeedforecastspshortterm> collect2 = wsfsstList1.stream().filter(w -> w.getId() != null)
+                .map(w->{
+                    Windspeedforecastspshortterm wsf = new Windspeedforecastspshortterm();
+                    wsf.setId(w.getId());
+                    wsf.setActualpower(w.getActualpower());
+                    wsf.setActualwindspeed(w.getActualwindspeed());
+                    wsf.setForecastpower(w.getForecastpower());
+                    wsf.setForecastwindspeed(w.getForecastwindspeed());
+                    return wsf;
+                }).collect(Collectors.toList());
+
+        windspeedforecastspshorttermService.insertBatch(wsfsstList1);
+        windspeedforecastspshorttermService.updateBatchById(wsfsstList2, 300);
+    }
+
+    private Date getThistime(Calendar today) {
+        Calendar time = (Calendar) today.clone();
+        time.add(Calendar.HOUR,-1);
+        time.set(Calendar.MINUTE, Math.floorDiv(time.get(Calendar.MINUTE), 15) * 15);
+        time.set(Calendar.SECOND, 0);
+        time.set(Calendar.MILLISECOND, 0);
+        return time.getTime();
     }
 
     private List<Windspeedforecastspshortterm> getStationWindspeedandpowerForecastSp() {
         List<Windspeedforecastspshortterm> wsfcsts = new ArrayList<>();
         if(wfUspTsPeriodDatas.size()==0) return wsfcsts;
-        for (short i = 1; i < 6; i++) {
+        /*for (short i = 1; i < 6; i++) {
             Calendar day = Calendar.getInstance();
-            day.add(Calendar.DATE, -1);
-            day.set(Calendar.HOUR_OF_DAY, 0);
-            day.set(Calendar.MINUTE, 0);
+            day.add(Calendar.HOUR,-1);
+            day.set(Calendar.MINUTE, Math.floorDiv(day.get(Calendar.MINUTE), 15) * 15);
             day.set(Calendar.SECOND, 0);
             day.set(Calendar.MILLISECOND, 0);
 
-            for (short j = 0; j < 96; j++) {
-                for (short k = 0; k < 24; k++) {
-                    Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
-                    wsfcst.setForecasttype("station");
-                    wsfcst.setStationid(decisionConvert.getStationIdMap().get(i));
-                    wsfcst.setStationname(decisionConvert.getStationNameMap().get(i));
-                    wsfcst.setCalctime(day.getTime());
-                    wsfcst.setForecasttime(k);
-                    wsfcst.setWyfcid(i);
-                    wsfcsts.add(wsfcst);
-                }
-                day.add(Calendar.MINUTE, 15);
+            //for (short j = 0; j < 96; j++) {
+            //    day.add(Calendar.MINUTE, 15);
+            //}
+            for (short k = 0; k < 24; k++) {
+                Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
+                wsfcst.setForecasttype("station");
+                wsfcst.setStationid(decisionConvert.getStationIdMap().get(i));
+                wsfcst.setStationname(decisionConvert.getStationNameMap().get(i));
+                wsfcst.setCalctime(day.getTime());
+                wsfcst.setForecasttime(k);
+                wsfcst.setWyfcid(i);
+                wsfcsts.add(wsfcst);
             }
+        }*/
+        for (WfUspTsPeriodData wfUspTsPeriodData : wfUspTsPeriodDatas) {
+            Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
+            wsfcst.setForecasttype("station");
+            wsfcst.setStationid(decisionConvert.getStationIdMap().get(wfUspTsPeriodData.getWindplantNo()));
+            wsfcst.setStationname(decisionConvert.getStationNameMap().get(wfUspTsPeriodData.getWindplantNo()));
+            wsfcst.setCalctime(wfUspTsPeriodData.getDataTime());
+            wsfcst.setForecasttime(wfUspTsPeriodData.getTimeScale());
+            wsfcst.setWyfcid(wfUspTsPeriodData.getWindplantNo());
+            wsfcst.setForecastpower(wfUspTsPeriodData.getModPower());
+            wsfcst.setAlgorithmmodel(decisionConvert.getSpModelNameMap().get(wfUspTsPeriodData.getModelNo()));
+            wsfcsts.add(wsfcst);
         }
         wsfcsts = wsfcsts.stream().map(wct -> {
             wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
@@ -357,10 +437,15 @@ public class TaskWindspeedForecast {
                     wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
                 wct.setForecastwindspeed(wnd.getWindSpeed());
             });
-            wfUspTsPeriodDatas.stream().filter(wutpd -> wct.getWyfcid()==wutpd.getWindplantNo() &&
+            /*wfUspTsPeriodDatas.stream().filter(wutpd -> wct.getWyfcid()==wutpd.getWindplantNo() &&
                     wct.getCalctime().compareTo(wutpd.getDataTime()) == 0 && wct.getForecasttime()==wutpd.getTimeScale()).forEach(wutpd -> {
                 wct.setForecastpower(wutpd.getModPower());
                 wct.setAlgorithmmodel(decisionConvert.getSpModelNameMap().get(wutpd.getModelNo()));
+            });*/
+            windspeedforecastspshortterms.stream().filter(wsfss->wct.getStationid().equals(wsfss.getStationid()) &&
+                    wct.getCalctime().equals(wsfss.getCalctime()) && wct.getForecasttime()==wsfss.getForecasttime() &&
+                    wct.getAlgorithmmodel().equals(wsfss.getAlgorithmmodel())).forEach(wsfss->{
+                        wct.setId(wsfss.getId());
             });
             return wct;
         }).collect(Collectors.toList());
@@ -466,9 +551,9 @@ public class TaskWindspeedForecast {
      * @param time
      * @return
      */
-    public List<NoscaleWfDaPfPeriodData> getNoscaleWfDaPfPeriodDatas(Calendar time) {
+    public List<NoscaleWfDaPfPeriodData> getNoscaleWfDaPfPeriodDatas(Date time) {
         QueryWrapper<NoscaleWfDaPfPeriodData> wrapper = new QueryWrapper();
-        wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
+        wrapper.gt("DATA_TIME", time)
                 .lt("WINDPLANT_NO",6);
                 //.orderByAsc("WINDPLANT_NO","DATA_TIME","MODEL_NO");
         noscaleWfDaPfPeriodDatas = noscaleWfDaPfPeriodDataMapper.selectList(wrapper);
@@ -513,9 +598,9 @@ public class TaskWindspeedForecast {
      * @param time
      * @return
      */
-    public List<WfStatPeriodData> getWfStatPeriodDatas(Calendar time) {
+    public List<WfStatPeriodData> getWfStatPeriodDatas(Date time) {
         QueryWrapper<WfStatPeriodData> wrapper = new QueryWrapper();
-        wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
+        wrapper.gt("DATA_TIME", time)
                 .lt("WINDPLANT_NO",6);
         wfStatPeriodDatas = wfStatPeriodDataMapper.selectList(wrapper);
         return wfStatPeriodDatas;
@@ -525,9 +610,9 @@ public class TaskWindspeedForecast {
      * @param time
      * @return
      */
-    public List<WfUspTsPeriodData> getWfUspTsPeriodDatas(Calendar time) {
+    public List<WfUspTsPeriodData> getWfUspTsPeriodDatas(Date time) {
         QueryWrapper<WfUspTsPeriodData> wrapper = new QueryWrapper();
-        wrapper.between("DATA_TIME", getStarttime(time), getEndtime(time))
+        wrapper.gt("DATA_TIME", time)
                 .lt("WINDPLANT_NO",6);
         wfUspTsPeriodDatas = wfUspTsPeriodDataMapper.selectList(wrapper);
         return wfUspTsPeriodDatas;
@@ -552,8 +637,124 @@ public class TaskWindspeedForecast {
      * @param time
      * @return
      */
-    public List<WfNwpData> getWfNwpDatas(Calendar time) {
-        wfNwpDatas = wfNwpDataMapper.getAllInDate((short) 6,getStarttime(time),getEndtime(time));
+    public List<WfNwpData> getWfNwpDatas(Date time) {
+        wfNwpDatas = wfNwpDataMapper.getAllInDate2((short) 6,time);
+        return wfNwpDatas;
+    }
+
+
+    @Scheduled(cron = "0 43 16 * * ?")
+    //去年同期
+    public void qntqTerm() throws KuduException {
+        Date date1 = DateUtil.str2DateTime("2021-08-01 00:00:00");
+        Date date2 = DateUtil.str2DateTime("2021-10-31 59:59:00");
+        getWfStatPeriodDatas2(date1,date2);
+        System.out.println(1);
+        getWfNwpDatas2(date1,date2);
+        System.out.println(2);
+        getNoscaleWfDaPfPeriodDatas2(date1,date2);
+        System.out.println(3);
+        getWfUspTsPeriodDatas2(date1,date2);
+        System.out.println(4);
+        //获取场站短期风速功率预测
+        List<Windspeedforecastshortterm> wsfstList1 = getStationWindspeedandpowerForecast1();
+        System.out.println(5);
+        //获取场站超短期风速功率预测
+        List<Windspeedforecastspshortterm> wsfsstList1 = getStationWindspeedandpowerForecastSp1();
+        System.out.println(6);
+
+        windspeedforecastshorttermService.insertBatch(wsfstList1);
+        System.out.println(7);
+        windspeedforecastspshorttermService.insertBatch(wsfsstList1);
+        System.out.println(8);
+    }
+
+    private List<Windspeedforecastshortterm> getStationWindspeedandpowerForecast1() {
+        List<Windspeedforecastshortterm> wsfcsts = new ArrayList<>();
+        if(noscaleWfDaPfPeriodDatas.size()==0) return wsfcsts;
+        for (NoscaleWfDaPfPeriodData noscaleWfDaPfPeriodData : noscaleWfDaPfPeriodDatas) {
+            Windspeedforecastshortterm wsfcst = new Windspeedforecastshortterm();
+            wsfcst.setForecasttype("station");
+            wsfcst.setStationid(decisionConvert.getStationIdMap().get(noscaleWfDaPfPeriodData.getWindplantNo()));
+            wsfcst.setStationname(decisionConvert.getStationNameMap().get(noscaleWfDaPfPeriodData.getWindplantNo()));
+            wsfcst.setCalctime(noscaleWfDaPfPeriodData.getDataTime());
+            wsfcst.setForecastpower(noscaleWfDaPfPeriodData.getValue());
+            wsfcst.setAlgorithmmodel(decisionConvert.getModelNameMap().get(noscaleWfDaPfPeriodData.getModelNo()));
+            wsfcst.setWyfcid(noscaleWfDaPfPeriodData.getWindplantNo());
+            wsfcsts.add(wsfcst);
+        }
+
+        wsfcsts = wsfcsts.stream().map(wct -> {
+            wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
+                    wct.getCalctime().compareTo(wspd.getDataTime()) == 0).forEach(wspd -> {
+                wct.setActualpower(wspd.getp0());
+                wct.setActualwindspeed(wspd.getAvgWindSpeed());
+            });
+            wfNwpDatas.stream().filter(wnd -> wct.getWyfcid()==wnd.getWindplantNo().shortValue() &&
+                    wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
+                wct.setForecastwindspeed(wnd.getWindSpeed());
+            });
+            return wct;
+        }).collect(Collectors.toList());
+
+        return wsfcsts;
+    }
+
+    private List<Windspeedforecastspshortterm> getStationWindspeedandpowerForecastSp1() {
+        List<Windspeedforecastspshortterm> wsfcsts = new ArrayList<>();
+        if(wfUspTsPeriodDatas.size()==0) return wsfcsts;
+        for (WfUspTsPeriodData wfUspTsPeriodData : wfUspTsPeriodDatas) {
+            Windspeedforecastspshortterm wsfcst = new Windspeedforecastspshortterm();
+            wsfcst.setForecasttype("station");
+            wsfcst.setStationid(decisionConvert.getStationIdMap().get(wfUspTsPeriodData.getWindplantNo()));
+            wsfcst.setStationname(decisionConvert.getStationNameMap().get(wfUspTsPeriodData.getWindplantNo()));
+            wsfcst.setCalctime(wfUspTsPeriodData.getDataTime());
+            wsfcst.setForecasttime(wfUspTsPeriodData.getTimeScale());
+            wsfcst.setWyfcid(wfUspTsPeriodData.getWindplantNo());
+            wsfcst.setForecastpower(wfUspTsPeriodData.getModPower());
+            wsfcst.setAlgorithmmodel(decisionConvert.getSpModelNameMap().get(wfUspTsPeriodData.getModelNo()));
+            wsfcsts.add(wsfcst);
+        }
+        wsfcsts = wsfcsts.stream().map(wct -> {
+            wfStatPeriodDatas.stream().filter(wspd -> wct.getWyfcid()==wspd.getWindplantNo() &&
+                    wct.getCalctime().compareTo(wspd.getDataTime()) == 0).forEach(wspd -> {
+                wct.setActualpower(wspd.getp0());
+                wct.setActualwindspeed(wspd.getAvgWindSpeed());
+            });
+            wfNwpDatas.stream().filter(wnd -> wct.getWyfcid()==wnd.getWindplantNo().shortValue() &&
+                    wct.getCalctime().compareTo(wnd.getDataTime()) == 0).forEach(wnd -> {
+                wct.setForecastwindspeed(wnd.getWindSpeed());
+            });
+            return wct;
+        }).collect(Collectors.toList());
+
+        return wsfcsts;
+    }
+
+    public List<WfStatPeriodData> getWfStatPeriodDatas2(Date time,Date time2) {
+        QueryWrapper<WfStatPeriodData> wrapper = new QueryWrapper();
+        wrapper.between("DATA_TIME", time,time2)
+                .lt("WINDPLANT_NO",6);
+        wfStatPeriodDatas = wfStatPeriodDataMapper.selectList(wrapper);
+        return wfStatPeriodDatas;
+    }
+    public List<WfNwpData> getWfNwpDatas2(Date time,Date time2) {
+        wfNwpDatas = wfNwpDataMapper.getAllInDate((short) 6,time,time2);
         return wfNwpDatas;
     }
+    public List<NoscaleWfDaPfPeriodData> getNoscaleWfDaPfPeriodDatas2(Date time,Date time2) {
+        QueryWrapper<NoscaleWfDaPfPeriodData> wrapper = new QueryWrapper();
+        wrapper.eq("MODEL_NO",7007).between("DATA_TIME", time,time2)
+                .lt("WINDPLANT_NO",6);
+        //.orderByAsc("WINDPLANT_NO","DATA_TIME","MODEL_NO");
+        noscaleWfDaPfPeriodDatas = noscaleWfDaPfPeriodDataMapper.selectList(wrapper);
+        return noscaleWfDaPfPeriodDatas;
+    }
+    public List<WfUspTsPeriodData> getWfUspTsPeriodDatas2(Date time,Date time2) {
+        QueryWrapper<WfUspTsPeriodData> wrapper = new QueryWrapper();
+        wrapper.eq("MODEL_NO",7014).between("DATA_TIME", time,time2)
+                .lt("WINDPLANT_NO",6);
+        wfUspTsPeriodDatas = wfUspTsPeriodDataMapper.selectList(wrapper);
+        return wfUspTsPeriodDatas;
+    }
 }

+ 46 - 14
gyee-sample-impala/src/main/resources/mapper/decision/WfNwpDataMapper.xml

@@ -4,23 +4,55 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.gyee.impala.model.decision.WfNwpData">
-        <id column="WINDPLANT_NO" property="windplantNo" />
-        <result column="NWP_TYPE" property="nwpType" />
-        <result column="FILE_TIME" property="fileTime" />
-        <result column="DATA_TIME" property="dataTime" />
-        <result column="WIND_SPEED" property="windSpeed" />
-        <result column="TEMPERATURE" property="temperature" />
-        <result column="WIND_DIR" property="windDir" />
-        <result column="HUMIDITY" property="humidity" />
-        <result column="AIR_PRESSURE" property="airPressure" />
+        <id column="WINDPLANT_NO" property="windplantNo"/>
+        <result column="NWP_TYPE" property="nwpType"/>
+        <result column="FILE_TIME" property="fileTime"/>
+        <result column="DATA_TIME" property="dataTime"/>
+        <result column="WIND_SPEED" property="windSpeed"/>
+        <result column="TEMPERATURE" property="temperature"/>
+        <result column="WIND_DIR" property="windDir"/>
+        <result column="HUMIDITY" property="humidity"/>
+        <result column="AIR_PRESSURE" property="airPressure"/>
     </resultMap>
 
     <select id="getAllInDate" resultType="com.gyee.impala.model.decision.WfNwpData">
-        SELECT * FROM (
-        SELECT WINDPLANT_NO, NWP_TYPE, FILE_TIME, DATA_TIME, WIND_SPEED, TEMPERATURE, WIND_DIR, HUMIDITY, AIR_PRESSURE,
-        ROW_NUMBER() OVER (partition by WINDPLANT_NO,DATA_TIME order by FILE_TIME DESC) NUM FROM WF_NWP_DATA
-        WHERE (DATA_TIME BETWEEN #{starttime,jdbcType=TIMESTAMP} AND #{endtime,jdbcType=TIMESTAMP} AND WINDPLANT_NO &lt;#{winno} AND NWP_TYPE = 7)
-        ) WHERE NUM=1
+        SELECT *
+        FROM (
+              SELECT WINDPLANT_NO,
+                     NWP_TYPE,
+                     FILE_TIME,
+                     DATA_TIME,
+                     WIND_SPEED,
+                     TEMPERATURE,
+                     WIND_DIR,
+                     HUMIDITY,
+                     AIR_PRESSURE,
+                     ROW_NUMBER() OVER (partition by WINDPLANT_NO,DATA_TIME order by FILE_TIME DESC) NUM
+              FROM WF_NWP_DATA
+              WHERE (DATA_TIME BETWEEN #{starttime,jdbcType=TIMESTAMP} AND #{endtime,jdbcType=TIMESTAMP} AND
+                     WINDPLANT_NO &lt; #{winno} AND NWP_TYPE = 7)
+                 )
+        WHERE NUM = 1
+    </select>
+
+    <select id="getAllInDate2" resultType="com.gyee.impala.model.decision.WfNwpData">
+        SELECT *
+        FROM (
+              SELECT WINDPLANT_NO,
+                     NWP_TYPE,
+                     FILE_TIME,
+                     DATA_TIME,
+                     WIND_SPEED,
+                     TEMPERATURE,
+                     WIND_DIR,
+                     HUMIDITY,
+                     AIR_PRESSURE,
+                     ROW_NUMBER() OVER (partition by WINDPLANT_NO,DATA_TIME order by FILE_TIME DESC) NUM
+              FROM WF_NWP_DATA
+              WHERE (DATA_TIME &gt; #{starttime,jdbcType=TIMESTAMP} AND
+                     WINDPLANT_NO &lt; #{winno} AND NWP_TYPE = 7)
+                 )
+        WHERE NUM = 1
     </select>
 
 </mapper>