xusl před 1 rokem
rodič
revize
5c7d1ab200

+ 8 - 1
ipfcst/ipfcst-reportquery/src/main/frontend/router/modules/realTimeQuery.js

@@ -16,7 +16,14 @@ const realTimeQueryRouter = {
       path: 'realPowerQuery',
       component: () => import('@/views/realTimeQuery/realPowerQuery'),
       name: 'realTimeQuery',
-      meta: { title: '实际功率查询', noCache: true },
+      meta: { title: '光伏实际功率查询', noCache: true },
+      sign: 'currency'
+    },
+    {
+      path: 'realPowerQueryOne',
+      component: () => import('@/views/realTimeQuery/realPowerQueryOne'),
+      name: 'realTimeQueryOne',
+      meta: { title: '风电实际功率查询', noCache: true },
       sign: 'currency'
     },
     {

+ 409 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/realPowerQueryOne/charts/index.vue

@@ -0,0 +1,409 @@
+<template>
+  <div style="width: 100%;height: 100%">
+    <div id="rpcharts"></div>
+  </div>
+</template>
+
+<script>
+  import resize from '../../../../components/Charts/mixins/resize'
+  import echarts from 'echarts'
+  import cc from '../../../curvecolors'
+  import variables from '@/styles/variables.scss'
+  export default {
+    mixins: [resize],
+    watch: {
+      drawData: {
+        handler(newValue, oldValue) {
+          // console.log(newValue)
+          this.draw(newValue,newValue.times, newValue.realValueDatas,newValue.ableValueDatas,newValue.theoryValueDatas,newValue.referencePowerByMeasuringDatas,newValue.referencePowerBySampleDatas,newValue.referencePowerByHubSpeedDatas,newValue.ablePowerByMeasuringDatas,newValue.ablePowerBySampleDatas,newValue.ablePowerByHubSpeedDatas,newValue.displayKyLl,newValue.displayJt,newValue.cap,newValue.cap)
+        },
+        deep: true
+      },
+      resizeKey: function (newQuestion, oldQuestion) {
+        if (this.chart != null) {
+          this.chart.resize();
+        }
+      }
+    },
+    props: {
+      drawData: {
+        type: Object,
+      },
+      resizeKey: {
+        type: Number
+      }
+    },
+    data() {
+      return {
+        lineColor:'',
+        chart: null,
+      }
+    },
+    mounted() {
+      if(sessionStorage.getItem('styleSwitch') === 'blue'){
+        this.lineColor = 'white'
+      }else{
+        this.lineColor = '#3b3b3b'
+      }
+    },
+    beforeDestroy() {
+      if (!this.chart) {
+        return
+      }
+      this.chart.dispose()
+      this.chart = null
+    },
+    methods: {
+      draw(newValue,timeaxis, realpower,ablepower,theorypower,referencePowerByMeasuringpower,referencePowerBySamplepower,referencePowerByHubSpeed,ablePowerByMeasuringe,ablePowerBySample,ablePowerByHubSpeed,displayKyLl,displayJt,cap) {
+        // console.log(referencePowerByMeasuringpower)
+        // console.log(ablePowerByMeasuringe)
+
+        this.chart = echarts.init(document.getElementById('rpcharts'))
+          var option = {
+          backgroundColor: 'transparent',
+          title: {
+            top: 20,
+            text: '实际功率实时查询',
+            textStyle: {
+              fontWeight: 'normal',
+              fontSize: 16,
+              color: this.lineColor
+            },
+            left: '1%'
+          },
+          tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          },
+          legend: {
+            top: 20,
+            icon: 'rect',
+            itemWidth: 14,
+            itemHeight: 5,
+            itemGap: 13,
+            data: ['实际功率'],
+            right: '4%',
+            textStyle: {
+              fontSize: 12,
+              color: this.lineColor
+            }
+          },
+          dataZoom: [{
+            show: true,
+            realtime: true,
+            start: 0,
+            end: 100,
+            left: "15%",
+            right: "15%",
+            textStyle: {
+              color:this.lineColor
+            }
+          }, {
+            type: 'inside'
+          }],
+          grid: {
+            top: 100,
+            left: '2%',
+            right: '2%',
+            bottom: '10%',
+            containLabel: true
+          },
+          xAxis: [{
+            type: 'category',
+            boundaryGap: false,
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+            data: timeaxis
+          }],
+          yAxis: [{
+            type: 'value',
+            name: '(MW)',
+            axisTick: {
+              show: false
+            },
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+            axisLabel: {
+              margin: 10,
+              textStyle: {
+                fontSize: 14
+              }
+            },
+            splitLine: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          }],
+          series: [{
+            name: '实际功率',
+            type: 'line',
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            // areaStyle: {
+            //   normal: {
+            //     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+            //       offset: 0,
+            //       color: 'rgba(219, 50, 51, 0.3)'
+            //     }, {
+            //       offset: 0.8,
+            //       color: 'rgba(219, 50, 51, 0)'
+            //     }], false),
+            //     shadowColor: 'rgba(0, 0, 0, 0.1)',
+            //     shadowBlur: 10
+            //   }
+            // },
+            itemStyle: {
+              normal: {
+
+                color: cc.sj,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: realpower
+          }]
+        }
+
+        option.yAxis[0].max = cap
+
+        if(displayKyLl == 1){
+          option.legend.data = ['实际功率','可用功率','理论功率','参照理论功率(测风、测光法)','参照理论功率(样板机法)','参照可用功率(测风、测光法)','参照可用功率(样板机法)']
+          option.series.push({
+            name: '可用功率',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+
+                color: cc.kygl,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: ablepower
+          },{
+            name: '理论功率',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            itemStyle: {
+              normal: {
+
+                color: cc.llgl,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: theorypower
+          },{
+            name: '参照理论功率(测风、测光法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.cfgf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: referencePowerByMeasuringpower
+          },{
+            name: '参照理论功率(样板机法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.ybjf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: referencePowerBySamplepower
+          },{
+            name: '参照可用功率(测风、测光法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.kycfgf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: ablePowerByMeasuringe
+          },{
+            name: '参照可用功率(样板机法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+                color: cc.kyybjf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: ablePowerBySample
+          })
+        }
+        if (displayJt==1){
+          option.legend.data = ['实际功率','可用功率','理论功率','参照理论功率(测风、测光法)','参照理论功率(样板机法)','参照可用功率(测风、测光法)','参照可用功率(样板机法)','参照理论功率(机头风速法)','参照可用功率(机头风速法)']
+          option.series.push({
+            name: '参照理论功率(机头风速法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+
+                color: cc.ybjf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: referencePowerByHubSpeed
+          },{
+            name: '参照可用功率(机头风速法)',
+            type: 'line',
+            smooth: true,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+
+            itemStyle: {
+              normal: {
+                color: cc.kyjtfsf,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+            data: ablePowerByHubSpeed
+          })
+        }
+        if(newValue.hasChartLine == 'true'){
+          var carr = ["#8A2BE2","#FF8C00","#0000E3","#85144b","#A8FF24"]
+
+          var arr = newValue.powerChartLine
+          for (let i = 0; i < arr.length; i++) {
+            option.legend.data.push(arr[i].title)
+            option.series.push({
+              name: arr[i].title,
+              type: 'line',
+              smooth: true,
+              symbol: 'circle',
+              symbolSize: 5,
+              showSymbol: false,
+              lineStyle: {
+                normal: {
+                  width: 2
+                }
+              },
+
+              itemStyle: {
+                normal: {
+
+                  color: carr[i],
+                  borderColor: 'rgba(219,50,51,0.2)',
+                  borderWidth: 12
+                }
+              },
+              data: newValue[arr[i].field]
+            })
+          }
+
+        }
+        this.chart.setOption(option,true)
+      },
+    }
+  }
+</script>
+<style scoped>
+  #rpcharts {
+    width: 100%;
+    height: calc(80vh - 50px);
+  }
+</style>

+ 346 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/realPowerQueryOne/index.vue

@@ -0,0 +1,346 @@
+<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 class="timeQuery">
+        <el-button  size="small" :loading="loading"  @click="dateQuery">查询</el-button>
+      </div>
+      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="fstToolBar" custom >
+        <template v-slot:buttons>
+          <vxe-button class="downloadButton" style="border:none;"  @click="exportDataEvent"><i class="vxe-icon--download" ></i></vxe-button>
+        </template>
+      </vxe-toolbar></div>
+      <div class="toolbar" v-show="this.showToolBar"> <vxe-toolbar ref="nwpToolBar" custom></vxe-toolbar></div>
+    </div>
+
+    <div class="content">
+      <el-tabs type="card" v-model="activeName" @tab-click="Byresize">
+        <el-tab-pane label="图表" name="first">
+          <chart :drawData = this.drawData :resizeKey=this.resizeKey  />
+        </el-tab-pane>
+        <el-tab-pane label="表格" name="second">
+          <div class="tableContent">
+            <vxe-grid
+              id="nwpTable"
+              ref="nwpRef"
+              border
+              export-config
+              :loading="loading"
+              @sort-change="sortChangeEvent"
+              :custom-config="{storage: true, checkMethod: checkColumnMethod}"
+              :auto-resize="true"
+              highlight-hover-row
+              :header-cell-style="styleStr"
+              max-height="90%"
+              :cell-style="styleTableStr"
+              align="center"
+              :data="tableData"
+              :columns="tableColumn"
+            >
+            </vxe-grid>
+            <div class="rtPageturning">
+              <vxe-pager
+                background
+                :loading="loading"
+                :current-page.sync="currentPage"
+                :page-size.sync="pageSize"
+                :total="total"
+                @page-change="handlePageChange"
+                :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+              </vxe-pager>
+            </div>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Chart from './charts'
+  import resize from '../../../components/Charts/mixins/resize'
+  export default {
+    name: 'nwp',
+    components: { Chart},
+    mixins: [resize],
+    data(){
+      return{
+        styleStr:{},
+        styleTableStr:{},
+        tableToolbar: {
+          export: true,
+          custom: true
+        },
+        tableColumn:[],
+        chart: null,
+        queryStartTime:'',
+        queryEndTime:'',
+        startTime:new Date(new Date().toLocaleDateString()).getTime(),
+        endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*1-1,
+        loading:true,
+        drawLoading:true,
+        tableLoading:true,
+        resizeKey:1,
+        activeName: 'first',
+        drawData:{datas:[],times:[]},
+        tableData:[],
+        total:0,
+        sortOrder:'asc',
+        pageSize: 10,
+        currentPage: 1,
+        showToolBar:false,
+        abandonmentRates:[]
+      }
+    },
+    created () {
+      if(sessionStorage.getItem('styleSwitch') === 'blue'){
+        this.styleStr = {background:'black',color:'white',border:'white'}
+        this.styleTableStr = {background:'black',color:'white'}
+      }
+      this.$nextTick(() => {
+        // 手动将表格和工具栏进行关联
+        this.$refs.nwpRef.connect(this.$refs.nwpToolBar)
+      })
+    },
+    mounted() {
+      this.init()
+    },
+    methods:{
+      exportDataEvent() {
+        this.loading = true
+        this.$axios.get('export/powerStationStatusOne/'+this.startTime+'/'+this.endTime, {
+          responseType: 'blob'// 用于解决中文乱码
+        }).then((response) => {
+          this.loading = false
+        }).catch((error) => {
+          this.loading = false
+          this.$message.error('导出失败' + error)
+        })
+      },
+      init(){
+        this.queryStartTime = this.startTime
+        this.queryEndTime = this.endTime
+        this.loading = true
+        this.getDraw(this.queryStartTime,this.queryEndTime)
+        this.getTable()
+
+      },
+      getDraw(startTime,endTime){
+        this.drawLoading = true
+        this.$axios.get('/powerStationStatusOne/'+startTime+'/'+endTime).then((res) => {
+          this.drawData = res.data
+          this.abandonmentRates = res.data.abandonmentRates
+          this.drawLoading = false
+          this.tableColumn = []
+          if(this.drawData.displayKyLl == '1'){
+            this.tableColumn = [
+              { field: 'time', title: '接入时间',formatter:this.dateFormat,sortable:true,minWidth:"150",width:"180" },
+              { field: 'realValue', title: '实际功率',minWidth:"60"},
+              { field: 'ableValue', title: '可用功率',minWidth:"60"},
+              { field: 'theoryValue', title: '理论功率',minWidth:"60"},
+              { field: 'referencePowerByMeasuring', title: '参照理论功率(测风、测光法)',minWidth:"60"},
+              { field: 'referencePowerBySample', title: '参照理论功率(样板机法)',minWidth:"60"},
+              { field: 'ablePowerByMeasuring', title: '参照可用功率(测风、测光法)',minWidth:"60"},
+              { field: 'ablePowerBySample', title: '参照可用功率(样板机法)',minWidth:"60"},
+              { field: 'openCapacity', title: '开机容量',minWidth:"60"},
+              { field: 'isRationingByManualControl', title: '人工判断是否限电',formatter:this.isRationingByManualControl,minWidth:"60"},
+              { field: 'isRationingByAutoControl', title: '系统判断是否限电',formatter:this.isRationingByAutoControl,minWidth:"60"},
+              { field: 'capacity', title: '装机容量',minWidth:"60"},
+              { field: 'onGridNum', title: '并网设备',minWidth:"60"}
+            ]
+          }else {
+            this.tableColumn = [
+              { field: 'time', title: '接入时间',formatter:this.dateFormat,sortable:true,minWidth:"150",width:"180" },
+              { field: 'realValue', title: '实际功率',minWidth:"60"},
+              { field: 'openCapacity', title: '开机容量',minWidth:"60"},
+              { field: 'isRationingByManualControl', title: '人工判断是否限电',formatter:this.isRationingByManualControl,minWidth:"60"},
+              { field: 'isRationingByAutoControl', title: '系统判断是否限电',formatter:this.isRationingByAutoControl,minWidth:"60"},
+              { field: 'capacity', title: '装机容量',minWidth:"60"},
+              { field: 'onGridNum', title: '并网设备',minWidth:"60"}
+            ]
+          }
+          if(this.drawData.abnormalShow == '1'){
+            this.tableColumn .push({ field: 'abnormalOfMeasuring', title: '测风光法的异常值',minWidth:"60"})
+            this.tableColumn .push({ field: 'abnormalOfSample', title: '样板机法的异常值',minWidth:"60"})
+            this.tableColumn .push({ field: 'abnormalOfHubSpeed', title: '机头风速法的异常值',minWidth:"60"})
+          }
+          if(this.drawData.displaySz == '1'){
+            this.tableColumn .push({ field: 'onSiteObstructed', title: '站内受阻功率',minWidth:"60"})
+            this.tableColumn .push({ field: 'offSiteObstructed', title: '站外受阻功率',minWidth:"60"})
+            this.tableColumn .push({ field: 'abandonmentRates', title: '弃电率指标%',minWidth:"60"})
+          }
+          if(this.drawData.displayJt == '1'){
+            this.tableColumn .push({ field: 'referencePowerByHubSpeed', title: '参照理论功率(机头风速法)',minWidth:"60"})
+            this.tableColumn .push({field: 'ablePowerByHubSpeed', title: '参照可用功率(机头风速法)',minWidth:"60"})
+            this.tableColumn .push({ field: 'abnormalOfHubSpeed', title: '机头风速法的异常值',minWidth:"60"})
+          }
+
+          if(this.drawData.hasTableColumn == 'true'){
+            for (let i = 0; i < this.drawData.tableColumns.length; i++) {
+              this.tableColumn.push(this.drawData.tableColumns[i])
+            }
+
+          }
+          if(!this.drawLoading && !this.tableLoading){
+            this.loading = false
+          }
+        }).catch((error) => {
+          this.drawLoading = false
+          if(!this.drawLoading && !this.tableLoading){
+            this.loading = false
+          }
+          this.$message.error('查询实时预测短期echarts出错' + error)
+        })
+      },
+      getTable(){
+        this.tableLoading = true
+        this.$axios.get('/powerStationStatusOne/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPage+'/'+this.pageSize+'?sortOrder='+this.sortOrder).then((res) => {
+          this.tableData = res.data.content
+          // 表分页格数据总条数
+          this.total = res.data.count
+
+          this.tableLoading = false
+          if(!this.drawLoading && !this.tableLoading){
+            this.loading = false
+          }
+        }).catch((error) => {
+          this.tableLoading = false
+          if(!this.drawLoading && !this.tableLoading){
+            this.loading = false
+          }
+          this.$message.error('查询table出错' + error)
+        })
+
+      },
+      handlePageChange ({ currentPage, pageSize }) {
+        this.currentPage = currentPage
+        this.pageSize = pageSize
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+        this.loading = true
+        this.getTable();
+      },
+      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
+      },
+      isRationingByManualControl({ cellValue, row, column }) {
+        if (cellValue == 1){
+          return '限电'
+        }
+        if (cellValue == 0){
+          return '系统判断'
+        }
+        return '不限电'
+      },
+      isRationingByAutoControl({ cellValue, row, column }) {
+        if (cellValue){
+          return '限电'
+        }
+        return '不限电'
+      },
+      sortChangeEvent ({ column, property, order }) {
+        if(order == null){
+          order = 'asc'
+        }
+        this.currentPage = 1
+        this.sortOrder = order
+        this.loading = true
+        this.getTable()
+      },
+      checkColumnMethod ({ column }) {
+        if (column.property === 'preTime') {
+          return false
+        }
+        return true
+      },
+      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
+        }
+        this.queryStartTime = this.startTime
+        this.queryEndTime = this.endTime
+        this.getDraw(this.queryStartTime,this.queryEndTime)
+        this.getTable()
+      },
+      Byresize(tab){
+        if(tab.name =='first'){
+          this.resizeKey++
+          this.showToolBar = false
+        }else{
+          this.showToolBar = true
+        }
+
+      },
+    }
+  }
+</script>
+
+<style scoped>
+  /*.chart-container{*/
+    /*position:relative;*/
+    /*width:100%;*/
+    /*height:calc(100vh - 50px);*/
+  /*}*/
+  /*.timeText{*/
+    /*opacity:0.69;*/
+    /*padding-right:7px;*/
+    /*font-size:14px;*/
+  /*}*/
+
+  /*.startTime{*/
+    /*display:inline-block;*/
+  /*}*/
+
+  /*.endTime{*/
+    /*display:inline-block;*/
+    /*padding-left:42px;*/
+  /*}*/
+
+  /*.tableContent{*/
+    /*width: 100%;*/
+    /*height:calc(80vh - 50px);*/
+  /*}*/
+  /*.toolbar{*/
+    /*position:absolute;right:0px;*/
+  /*}*/
+</style>
+

+ 197 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/PowerStationStatusDataOneController.java

@@ -0,0 +1,197 @@
+package com.jiayue.ipfcst.controller;
+
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.PowerStationStatusData;
+import com.jiayue.ipfcst.common.data.entity.PowerStationStatusDataOne;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
+import com.jiayue.ipfcst.common.data.repository.SysParameterRepository;
+import com.jiayue.ipfcst.service.PowerStationStatusDataOneService;
+import com.jiayue.ipfcst.service.PowerStationStatusDataService;
+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.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 实际功率restful接口
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/7 10:12
+ */
+@RestController
+@Slf4j
+public class PowerStationStatusDataOneController {
+
+  private final PowerStationStatusDataOneService powerStationStatusDataOneService;
+  private final SysParameterRepository sysParameterRepository;
+
+  @Autowired
+  public PowerStationStatusDataOneController(PowerStationStatusDataService powerStationStatusDataService, PowerStationStatusDataOneService powerStationStatusDataOneService, SysParameterRepository sysParameterRepository) {
+    this.powerStationStatusDataOneService = powerStationStatusDataOneService;
+    this.sysParameterRepository = sysParameterRepository;
+  }
+
+  /**
+   * 根据开始时间和结束时间查询 场站功率状态
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 结果集
+   */
+  @GetMapping(value = "/powerStationStatusOne/{startTime}/{endTime}")
+  public ResponseVO findByTimeBetween(@PathVariable("startTime") Long startTime,
+                                      @PathVariable("endTime") Long endTime) {
+    Map<String, Object> map = new HashMap<>();
+    try {
+      map = powerStationStatusDataOneService.findByTimeBetween(new Date(startTime), new Date(endTime));
+      return ResponseVO.success(map);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("场站功率状态查询错误");
+      return ResponseVO.fail(e.getMessage());
+    }
+  }
+
+  /**
+   * 分页查询 场站功率状态
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @GetMapping(value = "/powerStationStatusOne/{startTime}/{endTime}/{page}/{size}")
+  public ResponseVO findByTimeBetweenForPaging(@PathVariable("startTime") Long startTime,
+                                               @PathVariable("endTime") Long endTime,
+                                               @PathVariable("page") Integer page,
+                                               @PathVariable("size") Integer size,
+                                               String sortOrder) {
+    Map<String, Object> map = new HashMap<>();
+    try {
+      map = powerStationStatusDataOneService.findByTimeBetweenForPaging(new Date(startTime), new Date(endTime), page, size, sortOrder);
+      return ResponseVO.success(map);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("场站功率状态分页查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+
+
+  }
+
+  /**
+   * 分页查询 受阻电量
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return
+   */
+  @GetMapping(value = "/balkPowerOne/{startTime}/{endTime}")
+  public ResponseVO findBalkPower(@PathVariable("startTime") Long startTime,
+                                  @PathVariable("endTime") Long endTime) {
+    try {
+      List<Map<String, Object>> balkPower = powerStationStatusDataOneService.findBalkPower(new Date(startTime), new Date(endTime));
+      return ResponseVO.success(balkPower);
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("受阻电量查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+
+
+  }
+
+
+  /**
+   * 实际功率表格导出
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return
+   */
+  @GetMapping(value = "export/powerStationStatusOne/{startTime}/{endTime}")
+  public ResponseVO export(@PathVariable("startTime") Long startTime,
+                           @PathVariable("endTime") Long endTime,
+                           HttpServletResponse response
+
+  ) {
+    BufferedOutputStream bos = null;
+    try {
+      StringBuilder templateContent = new StringBuilder();
+      response.setCharacterEncoding("UTF-8");
+      List<PowerStationStatusDataOne> powerStationStatusDataList = powerStationStatusDataOneService.findByTimeBetween(startTime, endTime);
+
+      String header = "\"时间\"," + "\"实际功率\"," + "\"开机容量\","+ "\"人工判断是否限电\","+ "\"系统判断是否限电\"," + "\"装机容量\"" + "\r\n";
+      SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("DISPLAY_KY_LL");
+      StringBuilder content = new StringBuilder();
+      if (sysParameter != null && sysParameter.getSysValue().equals("1")) {
+        header = "\"时间\"," + "\"实际功率\"," + "\"可用功率\",\"理论功率\",\"参照理论功率(样板机)\",\"参照理论功率(测风、测光)\",\"参照理论功率(机头风速)\",\"参照可用功率(样板机)\",\"参照可用功率(测风、测光)\",\"参照可用功率(机头风速)\"," + "\"开机容量\","+ "\"人工判断是否限电\","+ "\"系统判断是否限电\"," + "\"装机容量\"" + "\r\n";
+        templateContent.append(header);
+        powerStationStatusDataList.forEach(s -> {
+          String isRationingByManualControl = "系统判断";
+          if(s.getIsRationingByManualControl()==1){
+            isRationingByManualControl ="限电";
+          }else if (s.getIsRationingByManualControl()==2){
+            isRationingByManualControl = "不限电";
+          }
+          String time = DateFormatUtils.format(s.getTime(),"yyyy-MM-dd HH:mm:ss");
+            content.append(time + "," + s.getRealValue() + "," + s.getAbleValue() + "," + s.getTheoryValue() + "," + s.getReferencePowerBySample() + "," + s.getReferencePowerByMeasuring() + ","+ s.getReferencePowerByHubSpeed()+ "," + s.getAblePowerBySample() + "," + s.getAblePowerByMeasuring() +"," + s.getAblePowerByHubSpeed()+ "," + s.getOpenCapacity() + ","  + isRationingByManualControl + ","  + (s.getIsRationingByAutoControl()?"限电":"不限电") + ","+ s.getCapacity() + "\r\n");
+        });
+      } else {
+        templateContent.append(header);
+        powerStationStatusDataList.forEach(s -> {
+          String isRationingByManualControl = "系统判断";
+          if(s.getIsRationingByManualControl()==1){
+            isRationingByManualControl ="限电";
+          }else if (s.getIsRationingByManualControl()==2){
+            isRationingByManualControl = "不限电";
+          }
+          String time = DateFormatUtils.format(s.getTime(),"yyyy-MM-dd HH:mm:ss");
+          content.append(time+ "," + s.getRealValue() + "," + s.getOpenCapacity() + ","  + isRationingByManualControl + ","  + (s.getIsRationingByAutoControl()?"限电":"不限电") + "," + s.getCapacity() + "\r\n");
+        });
+      }
+
+      templateContent.append(content.toString());
+      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+      response.setContentType("application/x-msdownload;charset=UTF-8");// 文件下载必须配置为application/x-msdownload
+      response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(sdf.format(startTime) + "至" + sdf.format(endTime) + "实际功率导出文件" + ".csv", "UTF-8"));// 中文文件名必须使用URLEncoder.encode进行转码
+      byte[] templateContentBytes = templateContent.toString().getBytes("UTF-8");
+      bos = new BufferedOutputStream(response.getOutputStream());// 向response中写入文件流
+      bos.write(new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF});// 指定csv文件用UTF-8字符集打开
+      bos.write(templateContentBytes);
+      response.flushBuffer();
+      templateContent = null;
+
+    } catch (Exception e) {
+      log.error("系统错误:" + e.getMessage(), e);
+      throw new RuntimeException(e);
+    } finally {
+      if (bos != null) {
+        try {
+          bos.close();
+        } catch (IOException e) {
+          log.error("系统错误:" + e.getMessage(), e);
+        }
+      }
+    }
+
+
+    return ResponseVO.success();
+  }
+}

+ 626 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/PowerStationStatusDataOneService.java

@@ -0,0 +1,626 @@
+package com.jiayue.ipfcst.service;
+
+import com.jiayue.ipfcst.common.data.entity.ElectricField;
+import com.jiayue.ipfcst.common.data.entity.PowerStationStatusData;
+import com.jiayue.ipfcst.common.data.entity.PowerStationStatusDataOne;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
+import com.jiayue.ipfcst.common.data.repository.PowerStationStatusDataOneRepository;
+import com.jiayue.ipfcst.common.data.repository.PowerStationStatusDataRepository;
+import com.jiayue.ipfcst.common.data.repository.SysParameterRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import com.jiayue.ipfcst.dto.TableColumn;
+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.Predicate;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 场站功率状态业务层
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/5 16:02
+ */
+@Service
+public class PowerStationStatusDataOneService extends BaseService {
+
+  private final PowerStationStatusDataOneRepository powerStationStatusDataOneRepository;
+
+  private final SysParameterRepository sysParameterRepository;
+
+  @Autowired
+  public PowerStationStatusDataOneService(PowerStationStatusDataRepository powerStationStatusDataRepository, PowerStationStatusDataOneRepository powerStationStatusDataOneRepository, SysParameterRepository sysParameterRepository) {
+    this.powerStationStatusDataOneRepository = powerStationStatusDataOneRepository;
+    this.sysParameterRepository = sysParameterRepository;
+  }
+
+  /**
+   * 根据开始时间和结束时间查询 场站功率状态 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 结果集
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetween(Date startTime, Date endTime) throws Exception {
+    Map<String, Object> map = new HashMap<>();
+    ElectricField electricField = super.getElectricField();
+    map.put("cap", electricField.getCapacity());
+    List<PowerStationStatusDataOne> list = new ArrayList<>();
+    List<PowerStationStatusDataOne> checkList = new ArrayList<>();
+    list = powerStationStatusDataOneRepository.findByTimeBetween(startTime, endTime);
+
+    long startTimeLong = startTime.getTime();
+    long endTimeLong = endTime.getTime();
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    long timeStep = 300000L;
+    if (startTimeLong % timeStep != 0) {
+      startTimeLong = startTimeLong - (startTimeLong % timeStep) + timeStep;
+    }
+    List<Float> realValueDatas = new ArrayList<>();
+    List<Float> ableValueDatas = new ArrayList<>();
+    List<Float> theoryValueDatas = new ArrayList<>();
+    List<Float> referencePowerByMeasuringDatas = new ArrayList<>();
+    List<Float> referencePowerBySampleDatas = new ArrayList<>();
+    List<Float> referencePowerByHubSpeedDatas= new ArrayList<>();
+    List<Float> ablePowerByMeasuringDatas = new ArrayList<>();
+    List<Float> ablePowerBySampleDatas = new ArrayList<>();
+    List<Float> ablePowerByHubSpeedDatas = new ArrayList<>();
+
+
+    List<String> times = new ArrayList<>();
+
+    for (long i = startTimeLong; i < endTimeLong; i = i + 300000) {
+      long finalI = i;
+      List<PowerStationStatusDataOne> p = list.stream().filter(t -> t.getTime().getTime() == finalI).collect(Collectors.toList());
+      if (p != null && p.size() > 0) {
+        checkList.add(p.get(0));
+      } else {
+        checkList.add(new PowerStationStatusDataOne());
+      }
+      String timeFormat = sdf.format(new Date(i));
+      times.add(timeFormat);
+    }
+
+    List<BigDecimal> realValues = checkList.stream().map(PowerStationStatusDataOne::getRealValue).collect(Collectors.toList());
+
+    BigDecimal nullValue = new BigDecimal(-99);
+    for (BigDecimal b : realValues) {
+      if (b.compareTo(nullValue) == 0) {
+        realValueDatas.add(null);
+      } else {
+        realValueDatas.add(b.floatValue());
+      }
+    }
+
+    String powerChartLine = super.getSysParameter("power_chart_line", "disable");
+
+    String hasChartLine = Boolean.FALSE.toString();
+
+    //数据形式严格遵守示例,示例:"备用字段1==data1,备用字段2==data2"
+    if(!powerChartLine.equals("disable")){
+      hasChartLine = Boolean.TRUE.toString();
+    }
+
+
+
+    String displayKyLl = "0";
+    SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("DISPLAY_KY_LL");
+
+    if (sysParameter != null && sysParameter.getSysValue().equals("1")) {
+      displayKyLl = "1";
+
+      List<BigDecimal> ableValue = checkList.stream().map(PowerStationStatusDataOne::getAbleValue).collect(Collectors.toList());
+      List<BigDecimal> theoryValue = checkList.stream().map(PowerStationStatusDataOne::getTheoryValue).collect(Collectors.toList());
+      List<BigDecimal> referencePowerByMeasuring = checkList.stream().map(PowerStationStatusDataOne::getReferencePowerByMeasuring).collect(Collectors.toList());
+      List<BigDecimal> referencePowerBySample = checkList.stream().map(PowerStationStatusDataOne::getReferencePowerBySample).collect(Collectors.toList());
+
+      for (BigDecimal b : ableValue) {
+        if (b.compareTo(nullValue) == 0) {
+          ableValueDatas.add(null);
+        } else {
+          ableValueDatas.add(b.floatValue());
+        }
+      }
+      for (BigDecimal b : theoryValue) {
+        if (b.compareTo(nullValue) == 0) {
+          theoryValueDatas.add(null);
+        } else {
+          theoryValueDatas.add(b.floatValue());
+        }
+      }
+
+      for (BigDecimal b : referencePowerByMeasuring) {
+        if (b.compareTo(nullValue) == 0) {
+          referencePowerByMeasuringDatas.add(null);
+        } else {
+          referencePowerByMeasuringDatas.add(b.floatValue());
+        }
+      }
+
+      for (BigDecimal b : referencePowerBySample) {
+        if (b.compareTo(nullValue) == 0) {
+          referencePowerBySampleDatas.add(null);
+        } else {
+          referencePowerBySampleDatas.add(b.floatValue());
+        }
+      }
+
+
+
+      List<BigDecimal> ablePowerByMeasuring = checkList.stream().map(PowerStationStatusDataOne::getAblePowerByMeasuring).collect(Collectors.toList());
+      List<BigDecimal> ablePowerBySample = checkList.stream().map(PowerStationStatusDataOne::getAblePowerBySample).collect(Collectors.toList());
+
+
+      for (BigDecimal b : ablePowerByMeasuring) {
+        if (b == null || b.compareTo(nullValue) == 0) {
+          ablePowerByMeasuringDatas.add(null);
+        } else {
+          ablePowerByMeasuringDatas.add(b.floatValue());
+        }
+      }
+      for (BigDecimal b : ablePowerBySample) {
+        if (b == null || b.compareTo(nullValue) == 0) {
+          ablePowerBySampleDatas.add(null);
+        } else {
+          ablePowerBySampleDatas.add(b.floatValue());
+        }
+      }
+
+
+      map.put("ablePowerByMeasuringDatas", ablePowerByMeasuringDatas);
+      map.put("ablePowerBySampleDatas", ablePowerBySampleDatas);
+
+
+      map.put("ableValueDatas", ableValueDatas);
+      map.put("theoryValueDatas", theoryValueDatas);
+      map.put("referencePowerByMeasuringDatas", referencePowerByMeasuringDatas);
+      map.put("referencePowerBySampleDatas", referencePowerBySampleDatas);
+
+
+
+    }
+
+    if (hasChartLine.equals(Boolean.TRUE.toString())){
+
+      String[] column = powerChartLine.split(",");
+
+      List<TableColumn> tableColumns = new ArrayList<>();
+      for (String c : column) {
+        String[] split = c.split("==");
+        TableColumn tableColumn = new TableColumn();
+        tableColumn.setTitle(split[0]);
+        tableColumn.setField(split[1]);
+        char[] chars = split[1].toCharArray();
+        chars[0] -= 32;
+        String s = new String(chars);
+        Method method = PowerStationStatusDataOne.class.getMethod("get" + s);
+        List<Float> bigDecimals = new ArrayList<>();
+
+
+        for (PowerStationStatusDataOne powerStationStatusDataOne : checkList) {
+          BigDecimal value = (BigDecimal) method.invoke(powerStationStatusDataOne);
+
+          if (value == null || value.compareTo(nullValue) == 0) {
+            bigDecimals.add(null);
+          } else {
+            bigDecimals.add(value.floatValue());
+          }
+
+        }
+
+        map.put(split[1],bigDecimals);
+        tableColumns.add(tableColumn);
+      }
+      map.put("powerChartLine",tableColumns);
+    }
+
+    String displaySz = "0";
+    SysParameter sysParameter2 = sysParameterRepository.findBySysKeyEquals("DISPLAY_SZ");
+
+    if (sysParameter2 != null && sysParameter2.getSysValue().equals("1")) {
+      displaySz = "1";
+    }
+
+    String abnormalShow = "0";
+    SysParameter abnormal_show = sysParameterRepository.findBySysKeyEquals("abnormal_show");
+
+    if (abnormal_show != null && abnormal_show.getSysValue().equals("1")) {
+      abnormalShow = "1";
+    }
+
+    String displayJt = "0";
+    SysParameter sysParameter1 = sysParameterRepository.findBySysKeyEquals("DISPLAY_JT");
+
+    if (sysParameter1 !=null && sysParameter1.getSysValue().equals("1")){
+      displayJt = "1";
+      List<BigDecimal> ableValue = checkList.stream().map(PowerStationStatusDataOne::getAbleValue).collect(Collectors.toList());
+      List<BigDecimal> theoryValue = checkList.stream().map(PowerStationStatusDataOne::getTheoryValue).collect(Collectors.toList());
+      List<BigDecimal> referencePowerByMeasuring = checkList.stream().map(PowerStationStatusDataOne::getReferencePowerByMeasuring).collect(Collectors.toList());
+      List<BigDecimal> referencePowerBySample = checkList.stream().map(PowerStationStatusDataOne::getReferencePowerBySample).collect(Collectors.toList());
+
+      List<BigDecimal> referencePowerByHubSpeed = checkList.stream().map(PowerStationStatusDataOne::getReferencePowerByHubSpeed).collect(Collectors.toList());
+      List<BigDecimal> ablePowerByHugSpeed = checkList.stream().map(PowerStationStatusDataOne::getAblePowerByHubSpeed).collect(Collectors.toList());
+      for (BigDecimal b : referencePowerByHubSpeed) {
+        if (b.compareTo(nullValue) == 0) {
+          referencePowerByHubSpeedDatas.add(null);
+        } else {
+          referencePowerByHubSpeedDatas.add(b.floatValue());
+        }
+      }
+
+      for (BigDecimal b : ablePowerByHugSpeed) {
+        if (b == null || b.compareTo(nullValue) == 0) {
+          ablePowerByHubSpeedDatas.add(null);
+        } else {
+          ablePowerByHubSpeedDatas.add(b.floatValue());
+        }
+      }
+      for (BigDecimal b : ableValue) {
+        if (b.compareTo(nullValue) == 0) {
+          ableValueDatas.add(null);
+        } else {
+          ableValueDatas.add(b.floatValue());
+        }
+      }
+      for (BigDecimal b : theoryValue) {
+        if (b.compareTo(nullValue) == 0) {
+          theoryValueDatas.add(null);
+        } else {
+          theoryValueDatas.add(b.floatValue());
+        }
+      }
+
+      for (BigDecimal b : referencePowerByMeasuring) {
+        if (b.compareTo(nullValue) == 0) {
+          referencePowerByMeasuringDatas.add(null);
+        } else {
+          referencePowerByMeasuringDatas.add(b.floatValue());
+        }
+      }
+
+      for (BigDecimal b : referencePowerBySample) {
+        if (b.compareTo(nullValue) == 0) {
+          referencePowerBySampleDatas.add(null);
+        } else {
+          referencePowerBySampleDatas.add(b.floatValue());
+        }
+      }
+      map.put("ablePowerByHubSpeedDatas", ablePowerByHubSpeedDatas);
+      map.put("referencePowerByHubSpeedDatas", referencePowerByHubSpeedDatas);
+
+      map.put("ablePowerByMeasuringDatas", ablePowerByMeasuringDatas);
+      map.put("ablePowerBySampleDatas", ablePowerBySampleDatas);
+
+
+      map.put("ableValueDatas", ableValueDatas);
+      map.put("theoryValueDatas", theoryValueDatas);
+      map.put("referencePowerByMeasuringDatas", referencePowerByMeasuringDatas);
+      map.put("referencePowerBySampleDatas", referencePowerBySampleDatas);
+
+
+    }
+
+    String hasTableColumn = Boolean.FALSE.toString();
+
+    String powerTableColumn = super.getSysParameter("power_table_column", "disable");
+
+
+    //数据形式严格遵守示例,示例:"备用字段1==data1,备用字段2==data2"
+    if(!powerTableColumn.equals("disable")){
+      hasTableColumn = Boolean.TRUE.toString();
+
+      String[] column = powerTableColumn.split(",");
+
+      List<TableColumn> tableColumns = new ArrayList<>();
+      for (String c : column) {
+        String[] split = c.split("==");
+        TableColumn tableColumn = new TableColumn();
+        tableColumn.setTitle(split[0]);
+        tableColumn.setField(split[1]);
+        tableColumns.add(tableColumn);
+      }
+      map.put("tableColumns",tableColumns);
+    }
+
+
+
+
+
+
+
+    map.put("times", times);
+    map.put("realValueDatas", realValueDatas);
+    map.put("displayKyLl", displayKyLl);
+    map.put("displaySz", displaySz);
+    map.put("displayJt",displayJt);
+    map.put("hasTableColumn", hasTableColumn);
+    map.put("hasChartLine", hasChartLine);
+    map.put("abnormalShow", abnormalShow);
+
+    return map;
+  }
+
+  /**
+   * 分页查询 场站功率状态 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenForPaging(Date startTime, Date endTime,
+                                                        Integer page, Integer size,
+                                                        String sortOrder) {
+    Map<String, Object> map = new HashMap<>();
+    Sort sort = Sort.by(Sort.Direction.ASC, "time");
+    if (sortOrder.contains("desc")) {
+      sort = Sort.by(Sort.Direction.DESC, "time");
+    }
+    Specification<PowerStationStatusDataOne> specification = this.Specification(startTime, endTime);
+    Pageable pageable = PageRequest.of(page - 1, size, sort);
+    Page powerStationStatusDataOne = powerStationStatusDataOneRepository.findAll(specification, pageable);
+    List<PowerStationStatusDataOne> datas = new ArrayList<>();
+    datas = powerStationStatusDataOne.getContent();
+    this.defaultReplace(datas);
+    List<Map<String, Object>> list = new ArrayList<>();
+    for (PowerStationStatusDataOne powerStationStatusData1 : datas) {
+
+      Map<String, Object> map1 = new HashMap<>();
+
+      map1.put("time", powerStationStatusData1.getTime());
+      map1.put("ableValue", powerStationStatusData1.getAbleValue());
+      map1.put("theoryValue", powerStationStatusData1.getTheoryValue());
+      map1.put("realValue", powerStationStatusData1.getRealValue());
+      map1.put("referencePowerByMeasuring", powerStationStatusData1.getReferencePowerByMeasuring());
+      map1.put("referencePowerBySample", powerStationStatusData1.getReferencePowerBySample());
+      map1.put("referencePowerByHubSpeed", powerStationStatusData1.getReferencePowerByHubSpeed());
+      map1.put("openCapacity", powerStationStatusData1.getOpenCapacity());
+      map1.put("capacity", powerStationStatusData1.getCapacity());
+      map1.put("onGridNum", powerStationStatusData1.getOnGridNum());
+      map1.put("onSiteObstructed", powerStationStatusData1.getOnSiteObstructed());
+      map1.put("offSiteObstructed", powerStationStatusData1.getOffSiteObstructed());
+      map1.put("abnormalOfMeasuring", powerStationStatusData1.getAbnormalOfMeasuring());
+      map1.put("abnormalOfSample", powerStationStatusData1.getAbnormalOfSample());
+      map1.put("abnormalOfHubSpeed", powerStationStatusData1.getAbnormalOfHubSpeed());
+      map1.put("isRationingByManualControl", powerStationStatusData1.getIsRationingByManualControl());
+      map1.put("isRationingByAutoControl", powerStationStatusData1.getIsRationingByAutoControl());
+      map1.put("ablePowerByMeasuring", powerStationStatusData1.getAblePowerByMeasuring());
+      map1.put("ablePowerBySample", powerStationStatusData1.getAblePowerBySample());
+      map1.put("ablePowerByHubSpeed", powerStationStatusData1.getAblePowerByHubSpeed());
+      if (powerStationStatusData1.getRealValue() != null && powerStationStatusData1.getRealValue().floatValue() != 0) {
+        BigDecimal b = powerStationStatusData1.getAbleValue().subtract(powerStationStatusData1.getRealValue());
+        map1.put("abandonmentRates", b.divide(powerStationStatusData1.getRealValue(), 2, BigDecimal.ROUND_HALF_UP));
+      } else {
+        map1.put("abandonmentRates", 0);
+      }
+      list.add(map1);
+    }
+
+    map.put("content", list);
+    map.put("count", powerStationStatusDataOne.getTotalElements());
+    return map;
+  }
+
+  /**
+   * 查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 过滤条件
+   */
+  Specification<PowerStationStatusDataOne> Specification(final Date startTime, final Date endTime) {
+    return (Specification<PowerStationStatusDataOne>) (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));
+      }
+      //添加排序的功能
+      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+
+    };
+  }
+
+  /**
+   * 根据开始时间和结束时间查询 场站功率状态 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 结果集
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenForContrast(Date startTime, Date endTime, Long timeStep) {
+    Map<String, Object> map = new HashMap<>();
+    List<PowerStationStatusDataOne> list = new ArrayList<>();
+
+    list = powerStationStatusDataOneRepository.findByTimeBetween(startTime, endTime);
+
+
+    long startTimeLong = startTime.getTime();
+    long endTimeLong = endTime.getTime();
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    if (startTimeLong % timeStep != 0) {
+      startTimeLong = startTimeLong - (startTimeLong % timeStep);
+    }
+    List<Float> realDatas = new ArrayList<>();
+    List<Float> ableDatas = new ArrayList<>();
+    List<Float> theoryDatas = new ArrayList<>();
+    List<Float> referencePowerByMeasuringDatas = new ArrayList<>();
+    List<Float> referencePowerBySampleDatas = new ArrayList<>();
+    List<String> times = new ArrayList<>();
+
+    for (long i = startTimeLong; i < endTimeLong; i = i + timeStep) {
+      long finalI = i;
+      List<PowerStationStatusDataOne> p = list.stream().filter(t -> t.getTime().getTime() == finalI).collect(Collectors.toList());
+      if (p != null && p.size() > 0) {
+
+        if (p.get(0).getRealValue().compareTo(new BigDecimal(-99)) == 0) {
+          realDatas.add(null);
+        } else {
+          realDatas.add(p.get(0).getRealValue().floatValue());
+        }
+
+        if (p.get(0).getAbleValue().compareTo(new BigDecimal(-99)) == 0) {
+          ableDatas.add(null);
+        } else {
+          ableDatas.add(p.get(0).getAbleValue().floatValue());
+        }
+
+        if (p.get(0).getTheoryValue().compareTo(new BigDecimal(-99)) == 0) {
+          theoryDatas.add(null);
+        } else {
+          theoryDatas.add(p.get(0).getTheoryValue().floatValue());
+        }
+
+        if (p.get(0).getReferencePowerByMeasuring().compareTo(new BigDecimal(-99)) == 0) {
+          referencePowerByMeasuringDatas.add(null);
+        } else {
+          referencePowerByMeasuringDatas.add(p.get(0).getReferencePowerByMeasuring().floatValue());
+        }
+
+        if (p.get(0).getReferencePowerBySample().compareTo(new BigDecimal(-99)) == 0) {
+          referencePowerBySampleDatas.add(null);
+        } else {
+          referencePowerBySampleDatas.add(p.get(0).getReferencePowerBySample().floatValue());
+        }
+        String timeFormat = sdf.format(new Date(i));
+        times.add(timeFormat);
+
+      } else {
+        String timeFormat = sdf.format(new Date(i));
+        times.add(timeFormat);
+        realDatas.add(null);
+        ableDatas.add(null);
+        theoryDatas.add(null);
+        referencePowerByMeasuringDatas.add(null);
+        referencePowerBySampleDatas.add(null);
+
+      }
+    }
+
+
+    map.put("times", times);
+    map.put("realDatas", realDatas);
+    map.put("ableDatas", ableDatas);
+    map.put("theoryDatas", theoryDatas);
+    map.put("referencePowerByMeasuringDatas", referencePowerByMeasuringDatas);
+    map.put("referencePowerBySampleDatas", referencePowerBySampleDatas);
+    return map;
+  }
+
+
+  /**
+   * 对集合进行 -99替换null操作,主要用于图标展示空值
+   *
+   * @param datas 需要替换集合
+   */
+  public void defaultReplace(List<PowerStationStatusDataOne> datas) {
+    BigDecimal nullBig = new BigDecimal(-99);
+    for (PowerStationStatusDataOne p : datas) {
+      if (p.getRealValue().compareTo(nullBig) == 0) {
+        p.setRealValue(null);
+      }
+      if (p.getAbleValue().compareTo(nullBig) == 0) {
+        p.setAbleValue(null);
+      }
+      if (p.getTheoryValue().compareTo(nullBig) == 0) {
+        p.setTheoryValue(null);
+      }
+      if (p.getOpenCapacity().compareTo(nullBig) == 0) {
+        p.setOpenCapacity(null);
+      }
+      if (p.getCapacity().compareTo(nullBig) == 0) {
+        p.setCapacity(null);
+      }
+      if (p.getOnSiteObstructed().compareTo(nullBig) == 0) {
+        p.setOnSiteObstructed(null);
+      }
+      if (p.getOffSiteObstructed().compareTo(nullBig) == 0) {
+        p.setOffSiteObstructed(null);
+      }
+    }
+
+  }
+
+  /**
+   * 受阻电量查询(已废弃)
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<Map<String, Object>> findBalkPower(Date startTime, Date endTime) {
+
+    List<Map<String, Object>> resultList = new ArrayList<>();
+
+
+    List<PowerStationStatusDataOne> powerStationStatusDataList = powerStationStatusDataOneRepository.findByTimeBetween(startTime, endTime);
+
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    for (PowerStationStatusDataOne powerStationStatusData : powerStationStatusDataList) {
+      Map<String, Object> map = new HashMap<>();
+      map.put("time", sdf.format(powerStationStatusData.getTime()));
+      map.put("onSiteObstructed", powerStationStatusData.getOnSiteObstructed());
+      map.put("offSiteObstructed", powerStationStatusData.getOffSiteObstructed());
+      BigDecimal b = powerStationStatusData.getAbleValue().subtract(powerStationStatusData.getRealValue());
+      if (powerStationStatusData.getRealValue().floatValue() != 0) {
+        map.put("abandonmentRate", b.divide(powerStationStatusData.getRealValue(), 2, BigDecimal.ROUND_HALF_UP));
+      } else {
+        map.put("abandonmentRate", 0);
+      }
+
+      resultList.add(map);
+
+    }
+
+//    Sort sort = Sort.by(Sort.Direction.DESC, "time");
+//    if (sortOrder.contains("asc")) {
+//      sort = Sort.by(Sort.Direction.ASC, "time");
+//    }
+//    Specification<PowerStationStatusData> specification = this.Specification(startTime, endTime);
+//    Pageable pageable = PageRequest.of(page - 1, size, sort);
+//    Page pages = powerStationStatusDataRepository.findAll(specification, pageable);
+//    List<PowerStationStatusData> datas = new ArrayList<>();
+//    datas = pages.getContent();
+//    map.put("content", datas);
+//    map.put("count", pages.getTotalElements());
+
+    return resultList;
+
+
+  }
+
+  /**
+   * 根据时间查询数据并根据时间正序排序
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<PowerStationStatusDataOne> findByTimeBetween(Long startTime, Long endTime) {
+    List<PowerStationStatusDataOne> powerStationStatusDataList = powerStationStatusDataOneRepository.findByTimeBetween(new Date(startTime), new Date(endTime));
+    Collections.sort(powerStationStatusDataList, Comparator.comparing(PowerStationStatusDataOne::getTime));
+    return powerStationStatusDataList;
+  }
+}
+