소스 검색

逆变器后台数据查询类

xusl 3 년 전
부모
커밋
49c426e567

+ 445 - 0
ipfcst-console/src/main/frontend/views/dataquery/windTurbineStatusData/index.vue

@@ -0,0 +1,445 @@
+<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>
+    </div>
+    <div class="content">
+      <!--<el-tabs type="card" v-model="activeName" >-->
+        <!--<el-tab-pane  label="指定风机" name="first">-->
+          <div class="tableContent">
+            <vxe-table
+              id="wtNoTable"
+              ref="wtNoTable"
+              :loading="loading"
+              border
+              export-config
+              @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="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-column field="status" title="状态"min-width="60"></vxe-table-column>
+            </vxe-table>
+            <div class="rtPageturning">
+              <div class="toolbar">
+                <vxe-toolbar ref="fstToolBar" >
+                  <template v-slot:buttons>
+                    <vxe-button style="background:transparent;border:none"  @click="exportDataEvent"><i class="vxe-icon--download" style="color: white"></i></vxe-button>
+                  </template>
+                </vxe-toolbar></div>
+              <vxe-pager
+                background
+                :loading="loading"
+                :current-page.sync="currentPageNo"
+                :page-size.sync="pageSizeNo"
+                :total="totalNo"
+                @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>
+
+<script>
+
+  export default {
+    name: 'inverterTable',
+    data(){
+      return{
+        loading:false,
+        queryStartTime:"",
+        queryEndTime:"",
+        startTime:new Date(new Date().toLocaleDateString()).getTime(),
+        endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000-1,
+        windTurbineInfoId:[],
+        windTurbineInfos:[],
+        wtDataNo:[],
+        wtDataAll:[],
+        activeName: 'first',
+        totalNo:0,
+        pageSizeNo: 10,
+        currentPageNo: 1,
+        sortOrderNo:'asc',
+        totalAll:0,
+        pageSizeAll: 10,
+        currentPageAll: 1,
+        sortOrderTime:'asc',
+        sortOrderNumber:'asc',
+
+
+      }
+    },
+    created () {
+      this.$nextTick(() => {
+        // 手动将表格和工具栏进行关联
+        // this.$refs.wtAllTable.connect(this.$refs.wtAllToolbar)
+        this.$refs.wtNoTable.connect(this.$refs.wtNoToolbar)
+      })
+    },
+    mounted(){
+      this.querywtInfo()
+    },
+    methods:{
+      querywtInfo() {
+        this.loading = true
+        this.$axios.get('/windTurbineInfos').then((res) => {
+          if (res.data != null && res.data.length > 0) {
+            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("没有风机设备信息")
+          }
+        }).catch((error) => {
+          this.loading = false
+          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) => {
+          this.wtDataNo = res.data.content
+          // 表分页格数据总条数
+          this.totalNo = res.data.count
+          this.loading=false
+        }).catch((error) => {
+          this.loading=false
+          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(){
+        this.loading=true
+        if(this.endTime<=this.startTime){
+          this.$message.error("开始时间不能小于结束时间")
+          this.startTime = this.queryStartTime
+          this.endTime = this.queryEndTime
+          this.loading=false
+          return
+        }
+        if(this.endTime-this.startTime> 60 * 60 * 24 * 1000*31){
+          this.startTime = this.queryStartTime
+          this.endTime = this.queryEndTime
+          this.$message.error("只能最多查询31天的数据哦")
+          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
+        this.querywtDataNo()
+        this.currentPageAll = 1
+        // this.querywtDataAll()
+      },
+      sortChangeEventNo ({ column, property, order }) {
+        if(order == null){
+          order = 'asc'
+        }
+        this.currentPageNo = 1
+        this.sortOrderNo = order
+        this.querywtDataNo()
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },
+      sortChangeEventAll ({ column, property, order }) {
+        if(order == null){
+          order = 'asc'
+        }
+        if(property == 'time'){
+          this.sortOrderTime = order
+        }
+        if(property == 'equipmentNo'){
+          this.sortOrderNumber = order
+        }
+        this.currentPageAll = 1
+        // this.querywtDataAll()
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },
+      checkColumnMethod ({ column }) {
+        if (column.property === 'time') {
+          return false
+        }
+        return true
+      },
+      dateFormat({ cellValue, row, column }) {
+        // return this.$XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss')
+        const date = new Date(cellValue) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
+        const Y = date.getFullYear() + '-'
+        const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+        const D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '    '
+        const H = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':'
+        const m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':'
+        const s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())
+        return Y + M + D + H + m + s
+      },
+      nameFormat({ cellValue, row, column }) {
+        var name ='未知设备'
+        for(let index in this.windTurbineInfos) {
+          if(cellValue == this.windTurbineInfos[index].id){
+            name = this.windTurbineInfos[index].name
+          }
+        };
+        return name
+      },
+      handlePageChangeNo ({ currentPage, pageSize }) {
+        this.currentPageNo = currentPage
+        this.pageSizeNo = pageSize
+        this.querywtDataNo();
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },
+      handlePageChangeAll({ currentPage, pageSize }){
+        this.currentPageAll = currentPage
+        this.pageSizeAll = pageSize
+        // this.querywtDataAll();
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },exportDataEvent() {
+        this.loading = true
+        this.$axios.get('/export/windTurbineStatusData/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.windTurbineInfoId, {
+          responseType: 'blob'// 用于解决中文乱码
+        }).then((response) => {
+          this.loading = false
+        }).catch((error) => {
+          this.loading = false
+          this.$message.error('导出失败' + error)
+        })
+      },
+    }
+  }
+</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;
+  }
+</style>
+

+ 64 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterStatusDataController.java

@@ -0,0 +1,64 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.InverterStatusData;
+import com.jiayue.ipfcst.console.service.InverterInfoService;
+import com.jiayue.ipfcst.console.service.InverterStatusDataService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.DateFormatUtils;
+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 javax.servlet.http.HttpServletResponse;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@RestController
+@Slf4j
+public class InverterStatusDataController {
+
+  private final InverterStatusDataService inverterStatusDataService;
+  private final InverterInfoService inverterInfoService;
+
+  @Autowired
+  public InverterStatusDataController(InverterStatusDataService inverterStatusDataService, InverterInfoService inverterInfoService) {
+    this.inverterStatusDataService = inverterStatusDataService;
+    this.inverterInfoService = inverterInfoService;
+  }
+
+
+  /**
+   * 分页查询 所有逆变器功率状态
+   *
+   * @param startTime     开始时间
+   * @param endTime       结束时间
+   * @param page          页码
+   * @param size          条数
+   * @param no            逆变器编号
+   * @return
+   */
+  @GetMapping(value = "/inverterStatusData/{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 = inverterStatusDataService.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());
+    }
+  }
+}

+ 215 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterStatusDataService.java

@@ -0,0 +1,215 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.InverterStatusData;
+import com.jiayue.ipfcst.common.data.repository.InverterStatusDataRepository;
+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 InverterStatusDataService {
+
+  private final InverterStatusDataRepository inverterStatusDataRepository;
+
+  @Autowired
+  public InverterStatusDataService(InverterStatusDataRepository inverterStatusDataRepository) {
+    this.inverterStatusDataRepository = inverterStatusDataRepository;
+  }
+
+
+  /**
+   * 根据时间和编号 分页查询 逆变器数据 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<InverterStatusData> specification = this.specificationFindByTimeAndNo(startTime, endTime, no);
+    Pageable pageable = PageRequest.of(page - 1, size, sort);
+    Page inverterStatusDatas = inverterStatusDataRepository.findAll(specification, pageable);
+    List<InverterStatusData> datas = new ArrayList<>();
+    datas = inverterStatusDatas.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);
+    map.put("count", inverterStatusDatas.getTotalElements());
+    return map;
+  }
+
+  /**
+   * 根据时间和编号 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param no        设备编号
+   * @return 过滤条件
+   */
+  Specification<InverterStatusData> specificationFindByTimeAndNo(final Date startTime, final Date endTime, final Integer[] no) {
+    return (Specification<InverterStatusData>) (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){
+//              predicates.add(cb.equal(root.get("equipmentNo").as(Integer.class), no));
+//            }
+      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 inverterId   设备编号
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenForPaging(String stationCode,Date startTime, Date endTime,
+                                                        Integer page, Integer size,
+                                                        String inverterId) {
+    Map<String, Object> map = new HashMap<>();
+    Sort sort = Sort.by(Sort.Direction.DESC, "time");
+    Specification<InverterStatusData> specification = this.specificationFindByTime(stationCode,startTime, endTime,inverterId);
+    Pageable pageable = PageRequest.of(page - 1, size, sort); //页码:前端从1开始,jpa从0开始,做个转换
+    Page inverterStatusDatas = inverterStatusDataRepository.findAll(specification, pageable);
+    List<InverterStatusData> datas = new ArrayList<>();
+    datas = inverterStatusDatas.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);// 结果集
+    map.put("count", inverterStatusDatas.getTotalElements());// 总记录数
+    return map;
+  }
+
+  /**
+   * 根据时间 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 过滤条件
+   */
+  Specification<InverterStatusData> specificationFindByTime(final String stationCode, final Date startTime, final Date endTime,final String inverterId) {
+    return (Specification<InverterStatusData>) (root, criteriaQuery, cb) -> {
+      List<Predicate> predicates = new ArrayList<>();
+      predicates.add(cb.equal(root.get("stationCode").as(String.class), stationCode));
+      if (!"ALL".equals(inverterId)){
+        predicates.add(cb.equal(root.get("equipmentId").as(String.class), inverterId));
+      }
+      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<InverterStatusData> datas) {
+    BigDecimal nullBig = new BigDecimal(-99);
+    for (InverterStatusData i : datas) {
+      if (i.getActivePower().compareTo(nullBig) == 0) {
+        i.setActivePower(null);
+      }
+      if (i.getReactivePower().compareTo(nullBig) == 0) {
+        i.setReactivePower(null);
+      }
+      if (i.getPowerFactor().compareTo(nullBig) == 0) {
+        i.setPowerFactor(null);
+      }
+      if (i.getVoltage().compareTo(nullBig) == 0) {
+        i.setVoltage(null);
+      }
+      if (i.getElectricalCurrent().compareTo(nullBig) == 0) {
+        i.setElectricalCurrent(null);
+      }
+      if (i.getDayElectricQuantity().compareTo(nullBig) == 0) {
+        i.setDayElectricQuantity(null);
+      }
+      if (i.getDayGridConnectedHours().compareTo(nullBig) == 0) {
+        i.setDayGridConnectedHours(null);
+      }
+    }
+
+  }
+
+
+  public List<InverterStatusData> findByTimeBetweenAndNo(Long startTime, Long endTime, Integer[] no) {
+    List<InverterStatusData> inverterStatusData = inverterStatusDataRepository.findByTimeBetweenAndEquipmentIdIn(new Date(startTime), new Date(endTime), no);
+
+    return inverterStatusData;
+  }
+
+}