Pārlūkot izejas kodu

风机数据查询增加

xusl 3 gadi atpakaļ
vecāks
revīzija
69c121f7b1

+ 0 - 5
ipfcst-console/src/main/frontend/views/dataquery/inverterStatusData/index.vue

@@ -185,11 +185,6 @@
           this.loading = false
           return
         }
-        if(this.windTurbineInfoId=="") {
-          this.$message.error("设备选项不能为空")
-          this.loading=false
-          return
-        }
 
         this.queryStartTime = this.startTime
         this.queryEndTime = this.endTime

+ 76 - 234
ipfcst-console/src/main/frontend/views/dataquery/windTurbineStatusData/index.vue

@@ -1,45 +1,49 @@
 <template>
   <div class="chart-container">
     <div class="filter">
-      <div class="startTime">
-        <span class="timeText">起始时间</span>
-        <el-date-picker
-          v-model="startTime"
-          :clearable="false"
-          type="datetime"
-          value-format="timestamp"
-          placeholder="选择日期">
-        </el-date-picker>
-      </div>
-      <div class="endTime">
-        <span class="timeText">截止时间</span>
-        <el-date-picker
-          v-model="endTime"
-          :clearable="false"
-          type="datetime"
-          value-format="timestamp"
-          placeholder="选择日期">
-        </el-date-picker>
-      </div>
-      <div>
-        <span class="timeText">设备编号</span>
-        <el-select v-model="windTurbineInfoId" multiple filterable  placeholder="请选择">
-          <el-option
-            v-for="item in windTurbineInfos"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id">
-          </el-option>
-        </el-select>
-      </div>
-      <div class="timeQuery">
-        <el-button  :loading=loading  size="small"  @click="dateQuery">查询</el-button>
-      </div>
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" @change="stationCodeChange">
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <span style="font-weight: bold;font-size: 14px">设备名称:</span>
+      <el-select v-model="windTurbineInfoId" clearable placeholder="请选择">
+        <el-option
+          v-for="item in windTurbineInfos"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id">
+        </el-option>
+      </el-select>
+      <span style="font-weight: bold;font-size: 14px">起始时间:</span>
+      <el-date-picker
+        v-model="startTime"
+        :clearable="false"
+        type="datetime"
+        value-format="timestamp"
+        placeholder="选择日期">
+      </el-date-picker>
+      <span style="font-weight: bold;font-size: 14px">截止时间:</span>
+      <el-date-picker
+        v-model="endTime"
+        :clearable="false"
+        type="datetime"
+        value-format="timestamp"
+        placeholder="选择日期">
+      </el-date-picker>
+      <el-button  :loading=loading  size="small"  @click="dateQuery">查询</el-button>
     </div>
-    <div class="content">
+<!--    <div class="content">-->
       <!--<el-tabs type="card" v-model="activeName" >-->
         <!--<el-tab-pane  label="指定风机" name="first">-->
-          <div class="tableContent">
+<!--          <div class="tableContent">-->
+    <div style="padding-top: 10px">
             <vxe-table
               id="wtNoTable"
               ref="wtNoTable"
@@ -49,14 +53,12 @@
               @sort-change="sortChangeEventNo"
               :auto-resize="true"
               highlight-hover-row
-              :header-cell-style="{background:'black',color:'white',border:'white'}"
               max-height="90%"
               :resizable="true"
-              :cell-style="{background:'black',color:'white'}"
               align="center"
               :data="wtDataNo">
               <vxe-table-column  field="time" title="接收时间" :formatter="dateFormat" min-width="150" sortable ></vxe-table-column>
-              <vxe-table-column field="equipmentNo" title="编号" min-width="60" :formatter="nameFormat"></vxe-table-column>
+              <vxe-table-column field="equipmentId" title="名称" min-width="60" :formatter="nameFormat"></vxe-table-column>
               <vxe-table-column field="activePower" title="有功(KW)" min-width="60"></vxe-table-column>
               <vxe-table-column field="reactivePower" title="无功(KW)" min-width="60"></vxe-table-column>
               <vxe-table-column field="powerFactor" title="功率因数" min-width="60"></vxe-table-column>
@@ -87,58 +89,7 @@
                 @page-change="handlePageChangeNo"
                 :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
               </vxe-pager>
-            </div>
           </div>
-        <!--</el-tab-pane>-->
-        <!--<el-tab-pane label="所有风机" name="second">-->
-          <!--<div class="tableContent">-->
-            <!--<vxe-table-->
-              <!--id="wtAllTable"-->
-              <!--ref="wtAllTable"-->
-              <!--border-->
-              <!--:loading="loading"-->
-              <!--export-config-->
-              <!--@sort-change="sortChangeEventAll"-->
-              <!--:sync-resize="startTime"-->
-              <!--:auto-resize="true"-->
-              <!--:sort-config="{remote:'true'}"-->
-              <!--highlight-hover-row-->
-              <!--:header-cell-style="{background:'black',color:'white',border:'white'}"-->
-              <!--max-height="90%"-->
-              <!--:resizable="true"-->
-              <!--:cell-style="{background:'black',color:'white'}"-->
-              <!--align="center"-->
-              <!--:data="wtDataAll">-->
-              <!--<vxe-table-column  field="time" title="接收时间" :formatter="dateFormat" min-width="150" sortable ></vxe-table-column>-->
-              <!--<vxe-table-column field="equipmentNo" title="编号" min-width="60" sortable></vxe-table-column>-->
-              <!--<vxe-table-column field="activePower" title="有功(KW)" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="reactivePower" title="无功(KW)" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="powerFactor" title="功率因数" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="voltage" title="电压(V)" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="electricalCurrent" title="电流(A)" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="dayElectricQuantity" title="当日发电量(kW·h)" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="dayGridConnectedHours" title="当日并网小时" min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="windWheelRatedSpeed" title="转速(rpm)"min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="ws" title="风速(m/s)"min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="wd" title="风向(°)"min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="t" title="温度(℃)"min-width="60"></vxe-table-column>-->
-              <!--<vxe-table-column field="pitchAngle" title="桨距角(°)"min-width="60"></vxe-table-column>-->
-            <!--</vxe-table>-->
-            <!--<div class="rtPageturning">-->
-              <!--<vxe-toolbar ref="wtAllToolbar" export></vxe-toolbar>-->
-              <!--<vxe-pager-->
-                <!--:loading="loading"-->
-                <!--background-->
-                <!--:current-page.sync="currentPageAll"-->
-                <!--:page-size.sync="pageSizeAll"-->
-                <!--:total="totalAll"-->
-                <!--@page-change="handlePageChangeAll"-->
-                <!--:layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">-->
-              <!--</vxe-pager>-->
-            <!--</div>-->
-          <!--</div>-->
-        <!--</el-tab-pane>-->
-      <!--</el-tabs>-->
     </div>
   </div>
 </template>
@@ -149,6 +100,8 @@
     name: 'inverterTable',
     data(){
       return{
+        stationCode: '',
+        stationList: [],
         loading:false,
         queryStartTime:"",
         queryEndTime:"",
@@ -167,9 +120,7 @@
         pageSizeAll: 10,
         currentPageAll: 1,
         sortOrderTime:'asc',
-        sortOrderNumber:'asc',
-
-
+        sortOrderNumber:'asc'
       }
     },
     created () {
@@ -180,32 +131,36 @@
       })
     },
     mounted(){
-      this.querywtInfo()
+      this.getStationList()
     },
     methods:{
-      querywtInfo() {
-        this.loading = true
-        this.$axios.get('/windTurbineInfos').then((res) => {
-          if (res.data != null && res.data.length > 0) {
+      stationCodeChange() {
+        // 获取逆变器设备
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          // 清除设备下拉框
+          this.windTurbineInfos = ''
+        }
+        else{
+          this.$axios.get('/windTurbineInfo/findWindTurbineInfoByStation/' + queryParam).then((res) => {
             this.windTurbineInfos = res.data
-            this.windTurbineInfoId.push(this.windTurbineInfos[0].id)
-            this.queryStartTime = this.startTime
-            this.queryEndTime = this.endTime
-            this.querywtDataNo()
-            // this.querywtDataAll()
-          } else {
-            this.loading = false
-            this.$message.warning("没有风机设备信息")
-          }
+          })
+        }
+      },
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
         }).catch((error) => {
-          this.loading = false
-          this.$message.error('查询风机设备信息出错' + error)
+          this.$message.error('获取场站下拉框出错' + error)
         })
       },
-
       querywtDataNo(){
         this.loading=true
-        this.$axios.get('/windTurbineStatusData/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPageNo+'/'+this.pageSizeNo+'/'+this.windTurbineInfoId+'?timeSortOrder='+this.sortOrderTime+'&noSortOrder='+this.sortOrderNumber).then((res) => {
+        let windTurbineId = this.windTurbineInfoId;
+        if (windTurbineId==''){
+          windTurbineId="ALL"
+        }
+        this.$axios.get('/windTurbineStatusData/'+this.stationCode+'/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPageNo+'/'+this.pageSizeNo+'/'+windTurbineId).then((res) => {
           this.wtDataNo = res.data.content
           // 表分页格数据总条数
           this.totalNo = res.data.count
@@ -215,19 +170,12 @@
           this.$message.error('查询风机根据number出错' + error)
         })
       },
-      // querywtDataAll(){
-      //   this.loading=true
-      //   this.$axios.get('/windTurbineStatusData/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPageAll+'/'+this.pageSizeAll+'?timeSortOrder='+this.sortOrderTime+'&noSortOrder='+this.sortOrderNumber).then((res) => {
-      //     this.wtDataAll = res.data.content
-      //     // 表分页格数据总条数
-      //     this.totalAll = res.data.count
-      //     this.loading=false
-      //   }).catch((error) => {
-      //     this.loading=false
-      //     this.$message.error('查询所有风机出错' + error)
-      //   })
-      // },
       dateQuery(){
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          this.$message.error("请选择场站")
+          return;
+        }
         this.loading=true
         if(this.endTime<=this.startTime){
           this.$message.error("开始时间不能小于结束时间")
@@ -236,18 +184,14 @@
           this.loading=false
           return
         }
-        if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*31){
+        if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*3){
           this.startTime = this.queryStartTime
           this.endTime = this.queryEndTime
-          this.$message.error("只能最多查询31天的数据")
+          this.$message.error("只能最多查询3天的数据")
           this.loading = false
           return
         }
-        if(this.windTurbineInfoId=="") {
-            this.$message.error("设备选项不能为空")
-            this.loading=false
-            return
-          }
+
         this.queryStartTime = this.startTime
         this.queryEndTime = this.endTime
         this.currentPageNo = 1
@@ -335,111 +279,9 @@
 </script>
 
 <style scoped>
-  .chart-container{
-    position:relative;
-    width:100%;
-    height:calc(100vh - 50px);
-  }
-
-  .filter{
-    position:relative;
-    display:flex;
-    padding:20px 0 10px 15px;
-    font-size:12px;
-    line-height:11px;
-    color:white;
-    width: 100%;
-    background-color: transparent;
-    height: 10%;
-  }
-
-  input{
-    background:transparent;
-    border:none;
-    color:white;
-  }
-
-  .timeText{
-    opacity:0.69;
-    padding-right:7px;
-    font-size:14px;
-  }
-
-  .startTime{
-    display:inline-block;
-  }
-
-  .endTime{
-    display:inline-block;
-    padding-left:42px;
-  }
-
-
-  .timeQuery{
-    margin-left: 2%;
-    background:transparent;
-  }
-
-  .el-button{
-    background:transparent;
-    color:white;
-  }
-
-  .filter >>> input{
-    background:transparent;
-    border:none;
-    color:white;
-  }
-
-  .rtPageturning{
-    width: 100%;
-    height: 10%;
-    display: flex;
-    justify-content:space-between
-  }
-  .rtPageturning >>> button,
-  .rtPageturning >>> span,
-  .rtPageturning >>> input,
-  .rtPageturning >>> .vxe-pager--btn-wrapper li{
-    background-color: transparent !important;
-    color: #ffffff !important;
-    border: 1px solid #ffffff;
-  }
-  .rtPageturning >>> span{
-    border:none
-  }
-  .rtPageturning >>> .vxe-pager--wrapper .vxe-pager--btn-wrapper li:not(.disabled).is--active {
-    background-color: #9f9fa0 !important;
-  }
-
-  .tableContent{
-    width: 100%;
-    height:calc(80vh - 50px);
-  }
-  .tableContent >>> td{
-    border:1px solid #ffffff;
-  }
-  .content{
-    width: 100%;
-    background-color: transparent;
-    height: 90%;
-    padding-left: 5px;
-    padding-right: 5px;
-  }
-  .content >>> .el-tabs__item{
-    color: white;
-  }
-  .content >>> .el-tabs__item.is-active {
-    color: #409EFF;
-  }
 
-  .content >>> .vxe-button.type--button.is--circle{
-    padding: 0 .5em;
-    min-width: 34px;
-    border-radius: 10%;
-    border: none;
-    background: transparent;
-    color: white;
+  .my_table_insert .vxe-body--row.is--new {
+    background-color: #f1fdf1;
   }
 </style>
 

+ 17 - 1
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineInfoController.java

@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -156,7 +157,22 @@ public class WindTurbineInfoController {
       log.error(" 删除逆变器异常");
       return ResponseVO.fail();
     }
-
   }
 
+  /**
+   * 查询所有逆变器设备信息按ID排序 yh
+   * @return 结果集
+   */
+  @GetMapping(value = "findWindTurbineInfoByStation/{stationCode}")
+  public ResponseVO findWindTurbineInfoByStation(@PathVariable("stationCode") String stationCode){
+    List<WindTurbineInfo> list = new ArrayList<>();
+    try{
+      list = windTurbineInfoService.getByStationCode(stationCode);
+      return ResponseVO.success(list);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("风机信息所有查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
 }

+ 81 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineStatusDataController.java

@@ -0,0 +1,81 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
+import com.jiayue.ipfcst.console.service.WindTurbineStatusDataService;
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+
+@RestController
+@Slf4j
+public class WindTurbineStatusDataController {
+
+  private final WindTurbineStatusDataService windTurbineStatusDataService;
+  private final WindTurbineInfoService windTurbineInfoService;
+  @Autowired
+  public WindTurbineStatusDataController(WindTurbineStatusDataService windTurbineStatusDataService, WindTurbineInfoService windTurbineInfoService){
+    this.windTurbineStatusDataService = windTurbineStatusDataService;
+    this.windTurbineInfoService = windTurbineInfoService;
+  }
+
+
+  /**
+   * 分页查询 所有风机功率状态
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @param page 页码
+   * @param size 条数
+   * @param no   风机编号
+   * @return
+   */
+  @GetMapping(value = "/windTurbineStatusData/{stationCode}/{startTime}/{endTime}/{page}/{size}/{no}")
+  public ResponseVO findByTimeBetweenForPaging(@PathVariable("stationCode") String stationCode,
+                                               @PathVariable("startTime") Long startTime,
+                                               @PathVariable("endTime") Long endTime,
+                                               @PathVariable("page") Integer page,
+                                               @PathVariable("size") Integer size,
+                                               @PathVariable("no") String no){
+    Map<String,Object> map = new HashMap<>();
+    try{
+      map =  windTurbineStatusDataService.findByTimeBetweenForPaging(stationCode,new Date(startTime),new Date(endTime),page,size,no);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("风机分页查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+
+  /**
+   * 分页查询  按设备编号查询风机状态
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @param page 页码
+   * @param size 条数
+   * @return
+   */
+  @GetMapping(value = "/windTurbineStatusData/{startTime}/{endTime}/{page}/{size}/{no}")
+  public ResponseVO findByTimeBetweenForPaging(@PathVariable("startTime") Long startTime,
+                                               @PathVariable("endTime") Long endTime,
+                                               @PathVariable("page") Integer page,
+                                               @PathVariable("size") Integer size,
+                                               @PathVariable("no") Integer[] no,
+                                               String timeSortOrder, String noSortOrder){
+    Map<String,Object> map = new HashMap<>();
+    try{
+      map =  windTurbineStatusDataService.findByTimeBetweenAndNoForPaging(new Date(startTime),new Date(endTime),page,size,no,timeSortOrder,noSortOrder);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("按设备号风机分页查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+}

+ 0 - 2
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTurbineInfoService.java

@@ -248,8 +248,6 @@ public class WindTurbineInfoService extends BaseService {
         log.info("删除风机ID为[" + ids + "]成功!");
       }
     }
-
     return flag;
-
   }
 }

+ 219 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTurbineStatusDataService.java

@@ -0,0 +1,219 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.WindTurbineStatusData;
+import com.jiayue.ipfcst.common.data.repository.WindTurbineStatusDataRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.Predicate;
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 风机数据信息业务层
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/5 16:02
+ */
+@Service
+public class WindTurbineStatusDataService {
+
+  private final WindTurbineStatusDataRepository windTurbineStatusDataRepository;
+
+  @Autowired
+  public WindTurbineStatusDataService(WindTurbineStatusDataRepository windTurbineStatusDataRepository) {
+    this.windTurbineStatusDataRepository = windTurbineStatusDataRepository;
+  }
+
+
+  /**
+   * 根据时间和编号 分页查询 逆变器数据 yh
+   *
+   * @param startTime     开始时间
+   * @param endTime       结束时间
+   * @param no            设备编号
+   * @param page          页码
+   * @param size          条数
+   * @param timeSortOrder 排序
+   * @param noSortOrder   排序
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenAndNoForPaging(Date startTime, Date endTime,
+                                                             Integer page, Integer size,
+                                                             Integer[] no, String timeSortOrder, String noSortOrder) {
+    Map<String, Object> map = new HashMap<>();
+    List<Sort.Order> orders = new ArrayList<Sort.Order>();
+
+    if (timeSortOrder.indexOf("asc") >= 0) {
+      orders.add(new Sort.Order(Sort.Direction.ASC, "time"));
+    } else {
+      orders.add(new Sort.Order(Sort.Direction.DESC, "time"));
+    }
+
+    if (noSortOrder.indexOf("asc") >= 0) {
+      orders.add(new Sort.Order(Sort.Direction.ASC, "equipmentNo"));
+    } else {
+      orders.add(new Sort.Order(Sort.Direction.DESC, "equipmentNo"));
+    }
+
+    Sort sort = Sort.by(orders);
+    Specification<WindTurbineStatusData> specification = this.specificationFindByTimeAndNo(startTime, endTime, no);
+    Pageable pageable = PageRequest.of(page - 1, size, sort);
+    Page windTurbineStatusDatas = windTurbineStatusDataRepository.findAll(specification, pageable);
+    List<WindTurbineStatusData> datas = new ArrayList<>();
+    datas = windTurbineStatusDatas.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);
+    map.put("count", windTurbineStatusDatas.getTotalElements());
+    return map;
+  }
+
+  /**
+   * 根据时间和编号 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param no        设备编号
+   * @return 过滤条件
+   */
+  Specification<WindTurbineStatusData> specificationFindByTimeAndNo(final Date startTime, final Date endTime, final Integer[] no) {
+    return (Specification<WindTurbineStatusData>) (root, criteriaQuery, cb) -> {
+      List<Predicate> predicates = new ArrayList<>();
+      if (startTime != null) {
+        //大于或等于传入时间
+        predicates.add(cb.greaterThanOrEqualTo(root.get("time").as(Date.class), startTime));
+      }
+      if (endTime != null) {
+        //小于传入时间
+        predicates.add(cb.lessThan(root.get("time").as(Date.class), endTime));
+      }
+      if (no != null) {
+        List<Predicate> list = new ArrayList<Predicate>();
+        CriteriaBuilder.In<Integer> in = cb.in(root.get("equipmentNo"));
+        for (int i = 0; i < no.length; i++) {
+          in.value(no[i]);
+        }
+        predicates.add(in);
+      }
+      //添加排序的功能
+      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+
+    };
+  }
+
+  /**
+   * 根据时间和编号 分页查询 逆变器数据 yh
+   *
+   * @param startTime     开始时间
+   * @param endTime       结束时间
+   * @param page          页码
+   * @param size          条数
+   * @param windTurbineId 设备编号
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenForPaging(String stationCode,Date startTime, Date endTime,
+                                                        Integer page, Integer size,
+                                                        String windTurbineId) {
+    Map<String, Object> map = new HashMap<>();
+    Sort sort = Sort.by(Sort.Direction.DESC, "time");
+    Specification<WindTurbineStatusData> specification = this.specificationFindByTime(stationCode,startTime, endTime,windTurbineId);
+    Pageable pageable = PageRequest.of(page - 1, size, sort); //页码:前端从1开始,jpa从0开始,做个转换
+    Page windTurbineStatusDatas = windTurbineStatusDataRepository.findAll(specification, pageable);
+    List<WindTurbineStatusData> datas = new ArrayList<>();
+    datas = windTurbineStatusDatas.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);// 结果集
+    map.put("count", windTurbineStatusDatas.getTotalElements());// 总记录数
+    return map;
+  }
+
+  /**
+   * 根据时间 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 过滤条件
+   */
+  Specification<WindTurbineStatusData> specificationFindByTime(final String stationCode,final Date startTime, final Date endTime,final String windTurbineId) {
+    return (Specification<WindTurbineStatusData>) (root, criteriaQuery, cb) -> {
+      List<Predicate> predicates = new ArrayList<>();
+      predicates.add(cb.equal(root.get("stationCode").as(String.class), stationCode));
+      if (!"ALL".equals(windTurbineId)){
+        predicates.add(cb.equal(root.get("equipmentId").as(String.class), windTurbineId));
+      }
+      if (startTime != null) {
+        //大于或等于传入时间
+        predicates.add(cb.greaterThanOrEqualTo(root.get("time").as(Date.class), startTime));
+      }
+      if (endTime != null) {
+        //小于传入时间
+        predicates.add(cb.lessThan(root.get("time").as(Date.class), endTime));
+      }
+      //添加排序的功能
+      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+
+    };
+  }
+
+  /**
+   * 对集合进行 -99替换null操作,主要用于图标展示空值
+   *
+   * @param datas 需要替换集合
+   */
+  public void defaultReplace(List<WindTurbineStatusData> datas) {
+    BigDecimal nullBig = new BigDecimal(-99);
+    for (WindTurbineStatusData w : datas) {
+      if (w.getActivePower().compareTo(nullBig) == 0) {
+        w.setActivePower(null);
+      }
+      if (w.getReactivePower().compareTo(nullBig) == 0) {
+        w.setReactivePower(null);
+      }
+      if (w.getPowerFactor().compareTo(nullBig) == 0) {
+        w.setPowerFactor(null);
+      }
+      if (w.getVoltage().compareTo(nullBig) == 0) {
+        w.setVoltage(null);
+      }
+      if (w.getElectricalCurrent().compareTo(nullBig) == 0) {
+        w.setElectricalCurrent(null);
+      }
+      if (w.getDayElectricQuantity().compareTo(nullBig) == 0) {
+        w.setDayElectricQuantity(null);
+      }
+      if (w.getDayGridConnectedHours().compareTo(nullBig) == 0) {
+        w.setDayGridConnectedHours(null);
+      }
+      if (w.getWindWheelRatedSpeed().compareTo(nullBig) == 0) {
+        w.setWindWheelRatedSpeed(null);
+      }
+      if (w.getWs().compareTo(nullBig) == 0) {
+        w.setWs(null);
+      }
+      if (w.getWd().compareTo(nullBig) == 0) {
+        w.setWd(null);
+      }
+      if (w.getT().compareTo(nullBig) == 0) {
+        w.setT(null);
+      }
+      if (w.getPitchAngle().compareTo(nullBig) == 0) {
+        w.setPitchAngle(null);
+      }
+
+    }
+
+  }
+
+
+}