소스 검색

新增nwp一期二期

wanghc 2 년 전
부모
커밋
f42623b186

+ 25 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/NwpOneRepository.java

@@ -0,0 +1,25 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.NwpOne;
+
+import java.util.List;
+
+/**
+ * nwp数据仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/9/26 11:23
+ */
+public interface NwpOneRepository extends BaseRepository<NwpOne, Integer> {
+
+	void deleteByPreTimeBetween(Long startTime, Long endTime);
+
+	/**
+	 * 按时间段查询数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	List<NwpOne> findByPreTimeBetween(Long startTime, Long endTime);
+}

+ 25 - 0
ipfcst/ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/NwpTwoRepository.java

@@ -0,0 +1,25 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.NwpTwo;
+
+import java.util.List;
+
+/**
+ * nwp数据仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/9/26 11:23
+ */
+public interface NwpTwoRepository extends BaseRepository<NwpTwo, Integer> {
+
+	void deleteByPreTimeBetween(Long startTime, Long endTime);
+
+	/**
+	 * 按时间段查询数据
+	 *
+	 * @param startTime
+	 * @param endTime
+	 */
+	List<NwpTwo> findByPreTimeBetween(Long startTime, Long endTime);
+}

+ 13 - 14
ipfcst/ipfcst-reportquery/src/main/frontend/router/modules/realTimeQuery.js

@@ -50,20 +50,6 @@ const realTimeQueryRouter = {
       sign: 'windPower'
     },
 
-    // {
-    //   path: 'forecastPowerShortTerm',
-    //   component: () => import('@/views/realTimeQuery/forecastPowerShortTerm'),
-    //   name: 'forecastPowerShortTerm',
-    //   meta: { title: '实时短期查询', noCache: true },
-    //   sign: 'currency'
-    // },
-    // {
-    //   path: 'forecastPowerUltraShortTerm',
-    //   component: () => import('@/views/realTimeQuery/forecastPowerUltraShortTerm'),
-    //   name: 'forecastPowerShortTerm',
-    //   meta: { title: '实时超短期查询', noCache: true },
-    //   sign: 'currency'
-    // },
     {
       path: 'nwp',
       component: () => import('@/views/realTimeQuery/nwp'),
@@ -72,6 +58,19 @@ const realTimeQueryRouter = {
       sign: 'currency'
     },
     {
+      path: 'nwpOne',
+      component: () => import('@/views/realTimeQuery/nwpOne'),
+      name: 'nwpOne',
+      meta: { title: '实时NWP一期查询', noCache: true },
+      sign: 'currency'
+    },{
+      path: 'nwpTwo',
+      component: () => import('@/views/realTimeQuery/nwpTwo'),
+      name: 'nwpTwo',
+      meta: { title: '实时NWP二期查询', noCache: true },
+      sign: 'currency'
+    },
+    {
       path: 'forecastPowerShortTerm16',
       component: () => import('@/views/realTimeQuery/forecastPowerUltraShortTerm16'),
       name: 'forecastPowerShortTerm16',

+ 431 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/nwpOne/charts/index.vue

@@ -0,0 +1,431 @@
+<template>
+  <div style="width: 100%;height: 100%" >
+    <div id="nwpcharts"></div>
+  </div>
+</template>
+
+<script>
+  import resize from '../../../../components/Charts/mixins/resize'
+  import echarts from 'echarts'
+  import cc from '../../../curvecolors'
+  export default {
+    mixins: [resize],
+    watch: {
+      drawData:{
+        handler(newValue, oldValue) {
+          this.cName = newValue.cName
+          if(newValue.cName.ws10==undefined){
+            this.company = 'W/㎡'
+            this.thFormat = [
+              {key:"directRadiation",value:'直辐射'},
+              {key:"diffuseRadiation",value:'散辐射'},
+              {key:"swr",value:'总辐射'}
+              ]
+          }else {
+            this.thFormat = [{key:"ws10",value:this.cName.ws10},
+              {key:"ws30",value:this.cName.ws30},
+              {key:"ws50",value:this.cName.ws50},
+              {key:"ws70",value:this.cName.ws70},
+              {key:"ws80",value:this.cName.ws80},
+              {key:"ws90",value:this.cName.ws90},
+              {key:"ws100",value:this.cName.ws100},
+              {key:"ws170",value:this.cName.ws170}]
+          }
+
+          this.draw(newValue.times, newValue.datas)
+
+        },
+        deep: true
+      },
+      resizeKey:function(newQuestion, oldQuestion){
+        if(this.chart !=null){
+          this.chart.resize();
+        }
+      }
+    },
+    props: {
+      drawData:{
+        type:Object,
+      },
+      resizeKey:{
+        type:Number
+      }
+    },
+    data() {
+      return {
+        lineColor:'',
+        cName:{},
+        chart: null,
+        thFormat:[],
+        company:'m/s',
+        lineStyle:[
+          {
+            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.ws10,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(219,196,50,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.ws30,
+                borderColor: 'rgba(219,196,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(101,219,50,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.ws50,
+                borderColor: 'rgba(101,219,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,219,171,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.ws70,
+                borderColor: 'rgba(50,219,171,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,118,219,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.ws80,
+                borderColor: 'rgba(50,118,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(140,50,219,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.ws90,
+                borderColor: 'rgba(140,50,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(202,50,219,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.ws100,
+                borderColor: 'rgba(202,50,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,199,219,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.ws110,
+                borderColor: 'rgba(50,199,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(219,143,50,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.ws120,
+                borderColor: 'rgba(219,143,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          }
+        ]
+      }
+    },
+    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(timeaxis,datas) {
+        this.chart = echarts.init(document.getElementById('nwpcharts'))
+        var option = {
+          backgroundColor: 'transparent',
+          title: {
+            top: 20,
+            text: 'nwp一期信息',
+            textStyle: {
+              fontWeight: 'normal',
+              fontSize: 16,
+              color: this.lineColor
+            },
+            left: '1%'
+          },
+          tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          },
+          toolbox: {
+            feature: {
+              // dataView: {show: true, readOnly: false},
+              // magicType: {show: true, type: ['line', 'bar']},
+              // restore: {show: true},
+              saveAsImage: {show: true}
+            }
+          },
+          legend: {
+            top: 20,
+            width:'70%',
+            icon: 'rect',
+            itemWidth: 14,
+            itemHeight: 5,
+            itemGap: 13,
+            data: [],
+            right: '4%',
+            textStyle: {
+              fontSize: 12,
+              color: this.lineColor
+            },
+            selected:{
+            }
+          },
+          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:[]
+          }],
+          yAxis: [{
+            type: 'value',
+            name: this.company,
+            axisTick: {
+              show: false
+            },
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+
+            axisLabel: {
+              margin: 10,
+              textStyle: {
+                fontSize: 14,
+                color: this.lineColor
+              },
+              formatter: '{value}',
+            },
+            splitLine: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          }],
+          series: []
+        }
+        option.xAxis[0].data = timeaxis
+        var index = 0;
+        for(var key in datas){
+          var keyName='';
+          for(var i = 0 ;i<this.thFormat.length;i++){
+            if(key ==this.thFormat[i].key ){
+              keyName =this.thFormat[i].value;
+            }
+          }
+          option.legend.data.push(keyName)
+          if(index>5){
+            option.legend.selected[keyName] = false
+          }else{
+            option.legend.selected[keyName] = true
+          }
+          var sValue = {
+            name: '',
+            type: 'line',
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            // areaStyle: {},
+            itemStyle: {},
+            data: []
+          }
+          sValue.name = keyName
+          sValue.data = datas[key]
+          // sValue.areaStyle = this.lineStyle[index].areaStyle
+          sValue.itemStyle = this.lineStyle[index].itemStyle
+          option.series.push(sValue)
+          index++;
+        }
+        this.chart.setOption(option,true)
+      },
+
+    }
+  }
+</script>
+<style scoped>
+  #nwpcharts{
+    width: 100%;
+    height:calc(80vh - 50px);
+  }
+</style>

+ 313 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/nwpOne/index.vue

@@ -0,0 +1,313 @@
+<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"
+              :columns="tableColumn"
+              :data="tableData">
+            </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-tab-pane label="平均值统计" name="third">
+          <div class="tableContent">
+            <vxe-grid
+              id="nwpStatisticsTable"
+              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"
+              :columns="tableColumn"
+              :data="statisticsData">
+              </vxe-grid>
+          </div>
+         </el-tab-pane>
+      </el-tabs>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Chart from './charts'
+  import resize from '../../../components/Charts/mixins/resize'
+  export default {
+    name: 'nwpOne',
+    components: { Chart},
+    mixins: [resize],
+    data(){
+      return{
+        styleStr:{},
+        styleTableStr:{},
+        tableColumn:[],
+        chart: null,
+        queryStartTime:'',
+        queryEndTime:'',
+        startTime:new Date(new Date().toLocaleDateString()).getTime(),
+        endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*4-1,
+        loading:true,
+        drawLoading:true,
+        tableLoading:true,
+        resizeKey:1,
+        activeName: 'first',
+        drawData:{datas:[],times:[]},
+        tableData:[],
+        statisticsData:[],
+        total:0,
+        sortOrder:'asc',
+        pageSize: 10,
+        currentPage: 1,
+        showToolBar:false
+
+      }
+    },
+    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/nwpOne/'+this.startTime+'/'+this.endTime, {
+          responseType: 'blob'// 用于解决中文乱码
+        }).then((response) => {
+          this.loading = false
+        }).catch((error) => {
+          this.loading = false
+          this.$message.error('导出失败' + error)
+        })
+      },
+      init(){
+        this.$axios.get("nwpOne/getNwpDay").then(res=>{
+          var days = res.data + 1
+          this.endTime = new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*days-1
+          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('/nwpOne/'+startTime+'/'+endTime).then((res) => {
+          this.drawData = res.data
+          this.drawLoading = false
+          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('/nwpOne/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPage+'/'+this.pageSize+'?sortOrder='+this.sortOrder).then((res) => {
+          this.tableData = res.data.content
+          // 表分页格数据总条数
+          this.total = res.data.count
+          this.statisticsData = res.data.statistics
+          const cName = res.data.cName
+
+          this.tableColumn = [
+            { field: 'preTime', title: cName.preTime,formatter:this.dateFormat,minWidth:"150",width: "180"},
+            { field: 'scTime', title: cName.scTime,minWidth:"150"},
+              { field: 't', title: cName.t, minWidth:"90"},
+              { field: 'rh', title: cName.rh, minWidth:"90"},
+              { field: 'pressure', title: cName.pressure, minWidth:"90"},
+              { field: 'swr', title: cName.swr, minWidth:"110"},
+              { field: 'directRadiation', title: cName.directRadiation, minWidth:"110"},
+              { field: 'diffuseRadiation', title: cName.diffuseRadiation, minWidth:"110"},
+              { field: 'ws10', title: cName.ws10, minWidth:"120"},
+              { field: 'ws30', title: cName.ws30, minWidth:"120"},
+              { field: 'ws50', title: cName.ws50, minWidth:"120"},
+              { field: 'ws70', title: cName.ws70, minWidth:"120"},
+              { field: 'ws80', title: cName.ws80, minWidth:"120"},
+              { field: 'ws90', title: cName.ws90, minWidth:"120"},
+              { field: 'ws100', title: cName.ws100, minWidth:"130"},
+              { field: 'ws170', title: cName.ws170, minWidth:"130"},
+              { field: 'wd10', title: cName.wd10, minWidth:"110"},
+              { field: 'wd30', title: cName.wd30, minWidth:"110"},
+              { field: 'wd50', title: cName.wd50, minWidth:"110"},
+              { field: 'wd70', title: cName.wd70, minWidth:"110"},
+              { field: 'wd80', title: cName.wd80, minWidth:"110"},
+              { field: 'wd90', title: cName.wd90, minWidth:"110"},
+              { field: 'wd100', title: cName.wd100, minWidth:"110"},
+              { field: 'wd170', title: cName.wd170, minWidth:"110"},
+          ]
+          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)
+        })
+
+      },
+      getStatisticsTable(){
+        this.tableLoading = true
+        this.$axios.get('/nwpOne/'+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')
+      },
+      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>
+</style>
+

+ 431 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/nwpTwo/charts/index.vue

@@ -0,0 +1,431 @@
+<template>
+  <div style="width: 100%;height: 100%" >
+    <div id="nwpcharts"></div>
+  </div>
+</template>
+
+<script>
+  import resize from '../../../../components/Charts/mixins/resize'
+  import echarts from 'echarts'
+  import cc from '../../../curvecolors'
+  export default {
+    mixins: [resize],
+    watch: {
+      drawData:{
+        handler(newValue, oldValue) {
+          this.cName = newValue.cName
+          if(newValue.cName.ws10==undefined){
+            this.company = 'W/㎡'
+            this.thFormat = [
+              {key:"directRadiation",value:'直辐射'},
+              {key:"diffuseRadiation",value:'散辐射'},
+              {key:"swr",value:'总辐射'}
+              ]
+          }else {
+            this.thFormat = [{key:"ws10",value:this.cName.ws10},
+              {key:"ws30",value:this.cName.ws30},
+              {key:"ws50",value:this.cName.ws50},
+              {key:"ws70",value:this.cName.ws70},
+              {key:"ws80",value:this.cName.ws80},
+              {key:"ws90",value:this.cName.ws90},
+              {key:"ws100",value:this.cName.ws100},
+              {key:"ws170",value:this.cName.ws170}]
+          }
+
+          this.draw(newValue.times, newValue.datas)
+
+        },
+        deep: true
+      },
+      resizeKey:function(newQuestion, oldQuestion){
+        if(this.chart !=null){
+          this.chart.resize();
+        }
+      }
+    },
+    props: {
+      drawData:{
+        type:Object,
+      },
+      resizeKey:{
+        type:Number
+      }
+    },
+    data() {
+      return {
+        lineColor:'',
+        cName:{},
+        chart: null,
+        thFormat:[],
+        company:'m/s',
+        lineStyle:[
+          {
+            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.ws10,
+                borderColor: 'rgba(219,50,51,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(219,196,50,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.ws30,
+                borderColor: 'rgba(219,196,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(101,219,50,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.ws50,
+                borderColor: 'rgba(101,219,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,219,171,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.ws70,
+                borderColor: 'rgba(50,219,171,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,118,219,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.ws80,
+                borderColor: 'rgba(50,118,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(140,50,219,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.ws90,
+                borderColor: 'rgba(140,50,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(202,50,219,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.ws100,
+                borderColor: 'rgba(202,50,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(50,199,219,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.ws110,
+                borderColor: 'rgba(50,199,219,0.2)',
+                borderWidth: 12
+              }
+            },
+          },
+          {
+            areaStyle: {
+              normal: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
+                  offset: 0,
+                  color: 'rgba(219,143,50,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.ws120,
+                borderColor: 'rgba(219,143,50,0.2)',
+                borderWidth: 12
+              }
+            },
+          }
+        ]
+      }
+    },
+    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(timeaxis,datas) {
+        this.chart = echarts.init(document.getElementById('nwpcharts'))
+        var option = {
+          backgroundColor: 'transparent',
+          title: {
+            top: 20,
+            text: 'nwp二期信息',
+            textStyle: {
+              fontWeight: 'normal',
+              fontSize: 16,
+              color: this.lineColor
+            },
+            left: '1%'
+          },
+          tooltip: {
+            trigger: 'axis',
+            axisPointer: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          },
+          toolbox: {
+            feature: {
+              // dataView: {show: true, readOnly: false},
+              // magicType: {show: true, type: ['line', 'bar']},
+              // restore: {show: true},
+              saveAsImage: {show: true}
+            }
+          },
+          legend: {
+            top: 20,
+            width:'70%',
+            icon: 'rect',
+            itemWidth: 14,
+            itemHeight: 5,
+            itemGap: 13,
+            data: [],
+            right: '4%',
+            textStyle: {
+              fontSize: 12,
+              color: this.lineColor
+            },
+            selected:{
+            }
+          },
+          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:[]
+          }],
+          yAxis: [{
+            type: 'value',
+            name: this.company,
+            axisTick: {
+              show: false
+            },
+            axisLine: {
+              lineStyle: {
+                color: this.lineColor
+              }
+            },
+
+            axisLabel: {
+              margin: 10,
+              textStyle: {
+                fontSize: 14,
+                color: this.lineColor
+              },
+              formatter: '{value}',
+            },
+            splitLine: {
+              lineStyle: {
+                color: '#57617B'
+              }
+            }
+          }],
+          series: []
+        }
+        option.xAxis[0].data = timeaxis
+        var index = 0;
+        for(var key in datas){
+          var keyName='';
+          for(var i = 0 ;i<this.thFormat.length;i++){
+            if(key ==this.thFormat[i].key ){
+              keyName =this.thFormat[i].value;
+            }
+          }
+          option.legend.data.push(keyName)
+          if(index>5){
+            option.legend.selected[keyName] = false
+          }else{
+            option.legend.selected[keyName] = true
+          }
+          var sValue = {
+            name: '',
+            type: 'line',
+            smooth: false,
+            symbol: 'circle',
+            symbolSize: 5,
+            showSymbol: false,
+            lineStyle: {
+              normal: {
+                width: 2
+              }
+            },
+            // areaStyle: {},
+            itemStyle: {},
+            data: []
+          }
+          sValue.name = keyName
+          sValue.data = datas[key]
+          // sValue.areaStyle = this.lineStyle[index].areaStyle
+          sValue.itemStyle = this.lineStyle[index].itemStyle
+          option.series.push(sValue)
+          index++;
+        }
+        this.chart.setOption(option,true)
+      },
+
+    }
+  }
+</script>
+<style scoped>
+  #nwpcharts{
+    width: 100%;
+    height:calc(80vh - 50px);
+  }
+</style>

+ 313 - 0
ipfcst/ipfcst-reportquery/src/main/frontend/views/realTimeQuery/nwpTwo/index.vue

@@ -0,0 +1,313 @@
+<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"
+              :columns="tableColumn"
+              :data="tableData">
+            </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-tab-pane label="平均值统计" name="third">
+          <div class="tableContent">
+            <vxe-grid
+              id="nwpStatisticsTable"
+              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"
+              :columns="tableColumn"
+              :data="statisticsData">
+              </vxe-grid>
+          </div>
+         </el-tab-pane>
+      </el-tabs>
+    </div>
+  </div>
+</template>
+
+<script>
+  import Chart from './charts'
+  import resize from '../../../components/Charts/mixins/resize'
+  export default {
+    name: 'nwpTwo',
+    components: { Chart},
+    mixins: [resize],
+    data(){
+      return{
+        styleStr:{},
+        styleTableStr:{},
+        tableColumn:[],
+        chart: null,
+        queryStartTime:'',
+        queryEndTime:'',
+        startTime:new Date(new Date().toLocaleDateString()).getTime(),
+        endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*4-1,
+        loading:true,
+        drawLoading:true,
+        tableLoading:true,
+        resizeKey:1,
+        activeName: 'first',
+        drawData:{datas:[],times:[]},
+        tableData:[],
+        statisticsData:[],
+        total:0,
+        sortOrder:'asc',
+        pageSize: 10,
+        currentPage: 1,
+        showToolBar:false
+
+      }
+    },
+    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/nwpTwo/'+this.startTime+'/'+this.endTime, {
+          responseType: 'blob'// 用于解决中文乱码
+        }).then((response) => {
+          this.loading = false
+        }).catch((error) => {
+          this.loading = false
+          this.$message.error('导出失败' + error)
+        })
+      },
+      init(){
+        this.$axios.get("nwpTwo/getNwpDay").then(res=>{
+          var days = res.data + 1
+          this.endTime = new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000*days-1
+          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('/nwpTwo/'+startTime+'/'+endTime).then((res) => {
+          this.drawData = res.data
+          this.drawLoading = false
+          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('/nwpTwo/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPage+'/'+this.pageSize+'?sortOrder='+this.sortOrder).then((res) => {
+          this.tableData = res.data.content
+          // 表分页格数据总条数
+          this.total = res.data.count
+          this.statisticsData = res.data.statistics
+          const cName = res.data.cName
+
+          this.tableColumn = [
+            { field: 'preTime', title: cName.preTime,formatter:this.dateFormat,minWidth:"150",width: "180"},
+            { field: 'scTime', title: cName.scTime,minWidth:"150"},
+              { field: 't', title: cName.t, minWidth:"90"},
+              { field: 'rh', title: cName.rh, minWidth:"90"},
+              { field: 'pressure', title: cName.pressure, minWidth:"90"},
+              { field: 'swr', title: cName.swr, minWidth:"110"},
+              { field: 'directRadiation', title: cName.directRadiation, minWidth:"110"},
+              { field: 'diffuseRadiation', title: cName.diffuseRadiation, minWidth:"110"},
+              { field: 'ws10', title: cName.ws10, minWidth:"120"},
+              { field: 'ws30', title: cName.ws30, minWidth:"120"},
+              { field: 'ws50', title: cName.ws50, minWidth:"120"},
+              { field: 'ws70', title: cName.ws70, minWidth:"120"},
+              { field: 'ws80', title: cName.ws80, minWidth:"120"},
+              { field: 'ws90', title: cName.ws90, minWidth:"120"},
+              { field: 'ws100', title: cName.ws100, minWidth:"130"},
+              { field: 'ws170', title: cName.ws170, minWidth:"130"},
+              { field: 'wd10', title: cName.wd10, minWidth:"110"},
+              { field: 'wd30', title: cName.wd30, minWidth:"110"},
+              { field: 'wd50', title: cName.wd50, minWidth:"110"},
+              { field: 'wd70', title: cName.wd70, minWidth:"110"},
+              { field: 'wd80', title: cName.wd80, minWidth:"110"},
+              { field: 'wd90', title: cName.wd90, minWidth:"110"},
+              { field: 'wd100', title: cName.wd100, minWidth:"110"},
+              { field: 'wd170', title: cName.wd170, minWidth:"110"},
+          ]
+          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)
+        })
+
+      },
+      getStatisticsTable(){
+        this.tableLoading = true
+        this.$axios.get('/nwpTwo/'+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')
+      },
+      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>
+</style>
+

+ 145 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/NwpOneController.java

@@ -0,0 +1,145 @@
+package com.jiayue.ipfcst.controller;
+
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.NwpOne;
+import com.jiayue.ipfcst.service.NwpOneService;
+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 javax.servlet.http.HttpServletResponse;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * NWP信息restful接口
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/7 10:12
+ */
+@RestController
+@Slf4j
+public class NwpOneController {
+  private final NwpOneService nwpOneService;
+
+  @Autowired
+  public NwpOneController(NwpOneService nwpOneService) {
+    this.nwpOneService = nwpOneService;
+  }
+
+  /**
+   * 按时间查询实时nwp yh
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @return 结果集
+   */
+  @GetMapping(value = "/nwpOne/{startTime}/{endTime}")
+  public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
+                                          @PathVariable("endTime") Long endTime){
+    Map<String,Object> map = new HashMap<>();
+    try{
+      map = nwpOneService.findByForecastTimeBetween(startTime,endTime);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("nwp实时查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+
+  /**
+   * 分页查询  实时nwp
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @param page 页码
+   * @param size 条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @GetMapping(value = "/nwpOne/{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 =  nwpOneService.findByTimeBetweenAndNoForPaging(startTime,endTime,page,size,sortOrder);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("nwp实时分页查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+
+  /**
+   * nwp数据表格导出
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return
+   */
+  @GetMapping(value = "export/nwpOne/{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<NwpOne> nwpList = nwpOneService.findByTimeBetween(startTime, endTime);
+      SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+      String header = "\"预测时间\"," + "\"生成时间\"," + "\"温度\"," + "\"湿度\"," + "\"气压\"," + "\"总辐射\"," + "\"直辐射\"," + "\"散辐射\"," + "\"10米风速\"," + "\"30米风速\"," + "\"50米风速\"," + "\"70米风速\"," + "\"80米风速\"," + "\"90米风速\"," + "\"100米风速\"," + "\"170米风速\"," + "\"10米风向\"," + "\"30米风向\"," + "\"50米风向\"," + "\"70米风向\"," + "\"80米风向\"," + "\"90米风向\"," + "\"100米风向\"," + "\"170米风向\"," + "\r\n";
+      StringBuilder content = new StringBuilder();
+      nwpList.forEach(n ->{
+        content.append(sdf1.format(n.getPreTime())+","+n.getScTime()+","+n.getT()+","+n.getRh()+","+n.getPressure()+","+n.getLwr()+","+n.getDirectRadiation()+","+n.getDiffuseRadiation()+","+n.getWs10()+","+n.getWs30()+","+n.getWs50()+","+n.getWs70()+","+n.getWs80()+","+n.getWs90()+","+n.getWs100()+","+n.getWs170()+","+n.getWd10()+","+n.getWd30()+","+n.getWd50()+","+n.getWd70()+","+n.getWd80()+","+n.getWd90()+","+n.getWd100()+","+n.getWd170() + "\r\n");
+      });
+
+
+      templateContent.append(header);
+      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) + "nwp导出文件" + ".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();
+  }
+
+  @GetMapping(value = "nwpOne/getNwpDay")
+  public ResponseVO getNwpDay(){
+    return ResponseVO.success(nwpOneService.getNwpDay());
+  }
+}

+ 145 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/controller/NwpTwoController.java

@@ -0,0 +1,145 @@
+package com.jiayue.ipfcst.controller;
+
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.NwpTwo;
+import com.jiayue.ipfcst.service.NwpTwoService;
+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 javax.servlet.http.HttpServletResponse;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * NWP信息restful接口
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/7 10:12
+ */
+@RestController
+@Slf4j
+public class NwpTwoController {
+  private final NwpTwoService nwpTwoService;
+
+  @Autowired
+  public NwpTwoController(NwpTwoService nwpTwoService) {
+    this.nwpTwoService = nwpTwoService;
+  }
+
+  /**
+   * 按时间查询实时nwp yh
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @return 结果集
+   */
+  @GetMapping(value = "/nwpTwo/{startTime}/{endTime}")
+  public ResponseVO findByForecastTimeBetween(@PathVariable("startTime") Long startTime,
+                                          @PathVariable("endTime") Long endTime){
+    Map<String,Object> map = new HashMap<>();
+    try{
+      map = nwpTwoService.findByForecastTimeBetween(startTime,endTime);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("nwp实时查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+
+  /**
+   * 分页查询  实时nwp
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @param page 页码
+   * @param size 条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @GetMapping(value = "/nwpTwo/{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 =  nwpTwoService.findByTimeBetweenAndNoForPaging(startTime,endTime,page,size,sortOrder);
+      return ResponseVO.success(map);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("nwp实时分页查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
+
+  /**
+   * nwp数据表格导出
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return
+   */
+  @GetMapping(value = "export/nwpTwo/{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<NwpTwo> nwpList = nwpTwoService.findByTimeBetween(startTime, endTime);
+      SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+      String header = "\"预测时间\"," + "\"生成时间\"," + "\"温度\"," + "\"湿度\"," + "\"气压\"," + "\"总辐射\"," + "\"直辐射\"," + "\"散辐射\"," + "\"10米风速\"," + "\"30米风速\"," + "\"50米风速\"," + "\"70米风速\"," + "\"80米风速\"," + "\"90米风速\"," + "\"100米风速\"," + "\"170米风速\"," + "\"10米风向\"," + "\"30米风向\"," + "\"50米风向\"," + "\"70米风向\"," + "\"80米风向\"," + "\"90米风向\"," + "\"100米风向\"," + "\"170米风向\"," + "\r\n";
+      StringBuilder content = new StringBuilder();
+      nwpList.forEach(n ->{
+        content.append(sdf1.format(n.getPreTime())+","+n.getScTime()+","+n.getT()+","+n.getRh()+","+n.getPressure()+","+n.getLwr()+","+n.getDirectRadiation()+","+n.getDiffuseRadiation()+","+n.getWs10()+","+n.getWs30()+","+n.getWs50()+","+n.getWs70()+","+n.getWs80()+","+n.getWs90()+","+n.getWs100()+","+n.getWs170()+","+n.getWd10()+","+n.getWd30()+","+n.getWd50()+","+n.getWd70()+","+n.getWd80()+","+n.getWd90()+","+n.getWd100()+","+n.getWd170() + "\r\n");
+      });
+
+
+      templateContent.append(header);
+      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) + "nwp导出文件" + ".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();
+  }
+
+  @GetMapping(value = "nwpTwo/getNwpDay")
+  public ResponseVO getNwpDay(){
+    return ResponseVO.success(nwpTwoService.getNwpDay());
+  }
+}

+ 646 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/NwpOneService.java

@@ -0,0 +1,646 @@
+package com.jiayue.ipfcst.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.core.util.CommonUtil;
+import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
+import com.jiayue.ipfcst.common.data.entity.ElectricField;
+import com.jiayue.ipfcst.common.data.entity.Nwp;
+import com.jiayue.ipfcst.common.data.entity.NwpOne;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
+import com.jiayue.ipfcst.common.data.repository.NwpOneRepository;
+import com.jiayue.ipfcst.common.data.repository.NwpRepository;
+import com.jiayue.ipfcst.common.data.repository.SysParameterRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.DateFormatUtils;
+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.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * NWP实时业务层
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/5 16:02
+ */
+@Service
+@Slf4j
+public class NwpOneService extends BaseService {
+
+  private final NwpOneRepository nwpOneRepository;
+
+  private final SysParameterRepository sysParameterRepository;
+  @Autowired
+  public NwpOneService( NwpOneRepository nwpOneRepository, SysParameterRepository sysParameterRepository){
+    this.nwpOneRepository = nwpOneRepository;
+    this.sysParameterRepository = sysParameterRepository;
+  }
+  /**
+   * 按时间查询实时NWP yh
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @return 结果集
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String,Object> findByForecastTimeBetween(Long startTime, Long endTime) throws BusinessException {
+    Map<String,Object> map = new HashMap<>();
+    List<NwpOne> list = new ArrayList<>();
+    List<NwpOne> checkList = new ArrayList<>();
+    Map<String,Object> datas = new LinkedHashMap<>();
+    list = nwpOneRepository.findByPreTimeBetween(startTime, endTime);
+    list.sort(Comparator.comparing(NwpOne::getPreTime));
+
+    long startTimeLong  = startTime;
+    long endTimeLong  = endTime;
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    long timeStep = 900000L;
+    if(startTimeLong%timeStep !=0){
+      startTimeLong = startTimeLong -(startTimeLong%timeStep);
+    }
+    List<String> times = new ArrayList<>();
+
+    for(long i = startTimeLong;i<endTimeLong;i=i+timeStep){
+      long finalI = i;
+      List<NwpOne> p = list.stream().filter(t -> t.getPreTime() == finalI).collect(Collectors.toList());
+      if (p != null && p.size() > 0) {
+        checkList.add(p.get(0));
+      }else{
+        checkList.add(new NwpOne());
+      }
+      String timeFormat = sdf.format(new Date(i));
+      times.add(timeFormat);
+    }
+    this.defaultReplace(checkList);
+    ElectricField electricField = this.getElectricField();
+    List<BigDecimal> ws10Collect = new ArrayList<>();
+    List<BigDecimal> ws30Collect= new ArrayList<>();
+    List<BigDecimal> ws50Collect= new ArrayList<>();
+    List<BigDecimal> ws70Collect= new ArrayList<>();
+    List<BigDecimal> ws80Collect= new ArrayList<>();
+    List<BigDecimal> ws90Collect= new ArrayList<>();
+    List<BigDecimal> ws100Collect= new ArrayList<>();
+    List<BigDecimal> ws170Collect= new ArrayList<>();
+    List<BigDecimal> swrCollect= new ArrayList<>();
+    List<BigDecimal> diffuseRadiationCollect= new ArrayList<>();
+    List<BigDecimal> directRadiationCollect= new ArrayList<>();
+    Map<String,String> map1 = new HashMap<>();
+    if(electricField.getElectricFieldTypeEnum().getCode() == 1){
+      swrCollect = checkList.stream().map(NwpOne::getSwr).collect(Collectors.toList());
+      diffuseRadiationCollect = checkList.stream().map(NwpOne::getDiffuseRadiation).collect(Collectors.toList());
+      directRadiationCollect = checkList.stream().map(NwpOne::getDirectRadiation).collect(Collectors.toList());
+      datas.put("swr",swrCollect);
+      datas.put("diffuseRadiation",diffuseRadiationCollect);
+      datas.put("directRadiation",directRadiationCollect);
+
+    }else{
+      ws10Collect = checkList.stream().map(NwpOne::getWs10).collect(Collectors.toList());
+      ws30Collect = checkList.stream().map(NwpOne::getWs30).collect(Collectors.toList());
+      ws50Collect = checkList.stream().map(NwpOne::getWs50).collect(Collectors.toList());
+      ws70Collect = checkList.stream().map(NwpOne::getWs70).collect(Collectors.toList());
+      ws80Collect = checkList.stream().map(NwpOne::getWs80).collect(Collectors.toList());
+      ws90Collect = checkList.stream().map(NwpOne::getWs90).collect(Collectors.toList());
+      ws100Collect = checkList.stream().map(NwpOne::getWs100).collect(Collectors.toList());
+      ws170Collect = checkList.stream().map(NwpOne::getWs170).collect(Collectors.toList());
+      datas.put("ws10",ws10Collect);
+      datas.put("ws30",ws30Collect);
+      datas.put("ws50",ws50Collect);
+      datas.put("ws70",ws70Collect);
+      datas.put("ws80",ws80Collect);
+      datas.put("ws90",ws90Collect);
+      datas.put("ws100",ws100Collect);
+      datas.put("ws170",ws170Collect);
+      try {
+        SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("NWP_CHANGE_WIND");
+        if (sysParameter != null) {
+          String nwpChangeWind = sysParameter.getSysValue();
+          String[] windChangeName = nwpChangeWind.split(",");
+          if (windChangeName.length == 16) {
+            map1.put("ws10",windChangeName[0]+"米风速");
+            map1.put("ws30",windChangeName[1]+"米风速");
+            map1.put("ws50",windChangeName[2]+"米风速");
+            map1.put("ws70",windChangeName[3]+"米风速");
+            map1.put("ws80",windChangeName[4]+"米风速");
+            map1.put("ws90",windChangeName[5]+"米风速");
+            map1.put("ws100",windChangeName[6]+"米风速");
+            map1.put("ws170",windChangeName[7]+"米风速");
+          }
+        }
+
+      } catch (RuntimeException e) {
+        String errorInfo = "NWP风速风向别名参数获取失败" + CommonUtil.printStackTraceToString(e);
+        log.error(errorInfo, e);
+      }
+      if (map1.isEmpty()){
+        map1.put("ws10","10米风速");
+        map1.put("ws30","30米风速");
+        map1.put("ws50","50米风速");
+        map1.put("ws70","70米风速");
+        map1.put("ws80","80米风速");
+        map1.put("ws90","90米风速");
+        map1.put("ws100","100米风速");
+        map1.put("ws170","170米风速");
+      }
+    }
+
+
+    map.put("cName",map1);
+    map.put("times",times);
+    map.put("datas",datas);
+    return map;
+  }
+
+
+
+  /**
+   * 根据时间 分页查询 NWP数据 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenAndNoForPaging(Long startTime, Long endTime,
+                                                             Integer page, Integer size,
+                                                             String sortOrder)  {
+    Map<String, Object> map = new HashMap<>();
+    Sort sort = Sort.by(Sort.Direction.DESC, "preTime");
+    if (sortOrder.contains("asc")) {
+      sort = Sort.by(Sort.Direction.ASC, "preTime");
+    }
+    Specification<NwpOne> specification = this.specificationFindByTimeAndNo(startTime, endTime);
+    Pageable pageable = PageRequest.of(page - 1, size, sort);
+    Page nwps = nwpOneRepository.findAll(specification,pageable);
+    List<NwpOne> datas = new ArrayList<>();
+    datas = nwps.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);
+    map.put("count", nwps.getTotalElements());
+    Map<String,String> map1 = new HashMap<>();
+
+    try {
+      SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("NWP_CHANGE_WIND");
+      if (sysParameter != null) {
+        String nwpChangeWind = sysParameter.getSysValue();
+        String[] windChangeName = nwpChangeWind.split(",");
+        if (windChangeName.length == 16) {
+          map1.put("preTime","预测时间");
+          map1.put("scTime","生成时间");
+          map1.put("pressure","气压(KPa)");
+          map1.put("t","温度(℃)");
+          map1.put("rh","湿度(%)");
+          map1.put("swr","总辐射(W/㎡)");
+          map1.put("directRadiation","直辐射(W/㎡)");
+          map1.put("diffuseRadiation","散辐射(W/㎡)");
+          map1.put("senf","热感通量(W/㎡)");
+          map1.put("ws10",windChangeName[0]+"米风速(m/s)");
+          map1.put("ws30",windChangeName[1]+"米风速(m/s)");
+          map1.put("ws50",windChangeName[2]+"米风速(m/s)");
+          map1.put("ws70",windChangeName[3]+"米风速(m/s)");
+          map1.put("ws80",windChangeName[4]+"米风速(m/s)");
+          map1.put("ws90",windChangeName[5]+"米风速(m/s)");
+          map1.put("ws100",windChangeName[6]+"米风速(m/s)");
+          map1.put("ws170",windChangeName[7]+"米风速(m/s)");
+          map1.put("wd10",windChangeName[8]+"米风向(°)");
+          map1.put("wd30",windChangeName[9]+"米风向(°)");
+          map1.put("wd50",windChangeName[10]+"米风向(°)");
+          map1.put("wd70",windChangeName[11]+"米风向(°)");
+          map1.put("wd80",windChangeName[12]+"米风向(°)");
+          map1.put("wd90",windChangeName[13]+"米风向(°)");
+          map1.put("wd100",windChangeName[14]+"米风向(°)");
+          map1.put("wd170",windChangeName[15]+"米风向(°)");
+        }
+      }
+    } catch (RuntimeException e) {
+      String errorInfo = "NWP风速风向别名参数获取失败" + CommonUtil.printStackTraceToString(e);
+      log.error(errorInfo, e);
+    }
+    if (map1.isEmpty()){
+      map1.put("preTime","预测时间");
+      map1.put("scTime","生成时间");
+      map1.put("pressure","气压(KPa)");
+      map1.put("t","温度(℃)");
+      map1.put("rh","湿度(%)");
+      map1.put("swr","总辐射(W/㎡)");
+      map1.put("directRadiation","直辐射(W/㎡)");
+      map1.put("diffuseRadiation","散辐射(W/㎡)");
+      map1.put("senf","热感通量(W/㎡)");
+      map1.put("ws10","10米风速(m/s)");
+      map1.put("ws30","30米风速(m/s)");
+      map1.put("ws50","50米风速(m/s)");
+      map1.put("ws70","70米风速(m/s)");
+      map1.put("ws80","80米风速(m/s)");
+      map1.put("ws90","90米风速(m/s)");
+      map1.put("ws100","100米风速(m/s)");
+      map1.put("ws170","170米风速(m/s)");
+      map1.put("wd10","10米风向(m/s)");
+      map1.put("wd30","30米风向(m/s)");
+      map1.put("wd50","50米风向(m/s)");
+      map1.put("wd70","70米风向(m/s)");
+      map1.put("wd80","80米风向(m/s)");
+      map1.put("wd90","90米风向(m/s)");
+      map1.put("wd100","100米风向(m/s)");
+      map1.put("wd170","170米风向(m/s)");
+    }
+    map.put("cName",map1);
+    //################  统计  ##################
+    int days = DateMomentUtil.getDaysBetweenTwoDate(startTime,endTime+1000);
+    List<NwpOne> dataList = new ArrayList<>();
+    for (int i = 0 ; i < days; i++){
+      NwpOne nwp = new NwpOne();
+      List<NwpOne> nwpOneList = nwpOneRepository.findByPreTimeBetween(startTime + ((long) i * 60 * 60 * 24 * 1000),startTime + ((long) (i+1) * 60 * 60 * 24 * 1000 - 1000));
+      BigDecimal t = new BigDecimal(0);
+      BigDecimal rh = new BigDecimal(0);
+      BigDecimal pressure = new BigDecimal(0);
+      BigDecimal swr = new BigDecimal(0);
+      BigDecimal lwr = new BigDecimal(0);
+      BigDecimal directRadiation = new BigDecimal(0);
+      BigDecimal diffuseRadiation = new BigDecimal(0);
+      BigDecimal senf = new BigDecimal(0);
+      BigDecimal ws10 = new BigDecimal(0);
+      BigDecimal ws30 = new BigDecimal(0);
+      BigDecimal ws50 = new BigDecimal(0);
+      BigDecimal ws70 = new BigDecimal(0);
+      BigDecimal ws80 = new BigDecimal(0);
+      BigDecimal ws90 = new BigDecimal(0);
+      BigDecimal ws100 = new BigDecimal(0);
+      BigDecimal ws170 = new BigDecimal(0);
+      BigDecimal wd10 = new BigDecimal(0);
+      BigDecimal wd30 = new BigDecimal(0);
+      BigDecimal wd50 = new BigDecimal(0);
+      BigDecimal wd70 = new BigDecimal(0);
+      BigDecimal wd80 = new BigDecimal(0);
+      BigDecimal wd90 = new BigDecimal(0);
+      BigDecimal wd100 = new BigDecimal(0);
+      BigDecimal wd170 = new BigDecimal(0);
+      for(int j = 0; j < nwpOneList.size(); j++ ){
+          t = t.add(nwpOneList.get(j).getT() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getT());
+          rh = rh.add(nwpOneList.get(j).getRh() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getRh());
+          pressure = pressure.add(nwpOneList.get(j).getPressure() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getPressure());
+          swr = swr.add(nwpOneList.get(j).getSwr() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getSwr());
+          lwr = lwr.add(nwpOneList.get(j).getLwr() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getLwr());
+          directRadiation = directRadiation.add(nwpOneList.get(j).getDirectRadiation() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getDirectRadiation());
+          diffuseRadiation = diffuseRadiation.add(nwpOneList.get(j).getDiffuseRadiation() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getDiffuseRadiation());
+          senf = senf.add(nwpOneList.get(j).getSenf() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getSenf());
+          ws10 = ws10.add(nwpOneList.get(j).getWs10() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs10());
+          ws30 = ws30.add(nwpOneList.get(j).getWs30() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs30());
+          ws50 = ws50.add(nwpOneList.get(j).getWs50() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs50());
+          ws70 = ws70.add(nwpOneList.get(j).getWs70() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs70());
+          ws80 = ws80.add(nwpOneList.get(j).getWs80() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs80());
+          ws90 = ws90.add(nwpOneList.get(j).getWs90() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs90());
+          ws100 = ws100.add(nwpOneList.get(j).getWs100() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs100());
+          ws170 = ws170.add(nwpOneList.get(j).getWs170() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWs170());
+          wd10 = wd10.add(nwpOneList.get(j).getWd10() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd10());
+          wd30 = wd30.add(nwpOneList.get(j).getWd30() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd30());
+          wd50 = wd50.add(nwpOneList.get(j).getWd50() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd50());
+          wd70 = wd70.add(nwpOneList.get(j).getWd70() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd70());
+          wd80 = wd80.add(nwpOneList.get(j).getWd80() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd80());
+          wd90 = wd90.add(nwpOneList.get(j).getWd90() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd90());
+          wd100 = wd100.add(nwpOneList.get(j).getWd100() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd100());
+          wd170 = wd170.add(nwpOneList.get(j).getWd170() == null ? BigDecimal.valueOf(0) : nwpOneList.get(j).getWd170());
+      }
+      if(nwpOneList.size() > 0){
+        nwp.setScTime(nwpOneList.get(0).getScTime());
+        nwp.setScDate(nwpOneList.get(0).getScDate());
+        nwp.setPreTime(nwpOneList.get(0).getPreTime());
+        nwp.setPreDate(nwpOneList.get(0).getPreDate());
+        nwp.setFarmId(nwpOneList.get(0).getFarmId());
+        nwp.setT(t.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : t.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setRh(rh.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : rh.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setPressure(pressure.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : pressure.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setSwr(swr.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : swr.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setLwr(lwr.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : lwr.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setDirectRadiation(directRadiation.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : directRadiation.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setDiffuseRadiation(diffuseRadiation.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : diffuseRadiation.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setSenf(senf.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : senf.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs10(ws10.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws10.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs30(ws30.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws30.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs50(ws50.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws50.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs70(ws70.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws70.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs80(ws80.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws80.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs90(ws90.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws90.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs100(ws100.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws100.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs170(ws170.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws170.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd10(wd10.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd10.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd30(wd30.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd30.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd50(wd50.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd50.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd70(wd70.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd70.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd80(wd80.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd80.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd90(wd90.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd90.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd100(wd100.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd100.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd170(wd170.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd170.divide(BigDecimal.valueOf(nwpOneList.size()),2, BigDecimal.ROUND_HALF_UP));
+        dataList.add(nwp);
+      }
+    }
+
+    map.put("statistics", dataList);
+    return map;
+  }
+
+  /**
+   * 根据时间和编号 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 过滤条件
+   */
+  Specification<NwpOne> specificationFindByTimeAndNo(final Long startTime, final Long endTime) {
+    return (Specification<NwpOne>) (root, criteriaQuery, cb) -> {
+      List<Predicate> predicates = new ArrayList<>();
+      if (startTime!=null) {
+        //大于或等于传入时间
+        predicates.add(cb.greaterThanOrEqualTo(root.get("preTime").as(Long.class), startTime));
+      }
+      if (endTime!=null) {
+        //小于传入时间
+        predicates.add(cb.lessThan(root.get("preTime").as(Long.class), endTime));
+      }
+
+      //添加排序的功能
+      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+
+    };
+  }
+
+  /**
+   *  对集合进行 -99替换null操作,主要用于图标展示空值
+   *
+   * @param datas  需要替换集合
+   */
+  public void defaultReplace(List<NwpOne> datas){
+    BigDecimal nullBig =  new BigDecimal(-99);
+    for(NwpOne i :datas){
+
+
+      if(i.getT().compareTo(nullBig)==0){
+        i.setT(null);
+      }
+      if(i.getRh().compareTo(nullBig)==0){
+        i.setRh(null);
+      }
+      if(i.getPressure().compareTo(nullBig)==0){
+        i.setPressure(null);
+      }
+      if(i.getSwr().compareTo(nullBig)==0){
+        i.setSwr(null);
+      }
+      if(i.getDirectRadiation().compareTo(nullBig)==0){
+        i.setDirectRadiation(null);
+      }
+      if(i.getDiffuseRadiation().compareTo(nullBig)==0){
+        i.setDiffuseRadiation(null);
+      }
+      if(i.getSenf().compareTo(nullBig)==0){
+        i.setSenf(null);
+      }
+      if(i.getWs10().compareTo(nullBig)==0){
+        i.setWs10(null);
+      }
+      if(i.getWs30().compareTo(nullBig)==0){
+        i.setWs30(null);
+      }
+      if(i.getWs50().compareTo(nullBig)==0){
+        i.setWs50(null);
+      }
+      if(i.getWs70().compareTo(nullBig)==0){
+        i.setWs70(null);
+      }
+      if(i.getWs80().compareTo(nullBig)==0){
+        i.setWs80(null);
+      }
+      if(i.getWs90().compareTo(nullBig)==0){
+        i.setWs90(null);
+      }
+      if(i.getWs100().compareTo(nullBig)==0){
+        i.setWs100(null);
+      }
+      if(i.getWs170().compareTo(nullBig)==0){
+        i.setWs170(null);
+      }
+      if(i.getWd10().compareTo(nullBig)==0){
+        i.setWd10(null);
+      }
+      if(i.getWd30().compareTo(nullBig)==0){
+        i.setWd30(null);
+      }
+      if(i.getWd50().compareTo(nullBig)==0){
+        i.setWd50(null);
+      }
+      if(i.getWd70().compareTo(nullBig)==0){
+        i.setWd70(null);
+      }
+      if(i.getWd80().compareTo(nullBig)==0){
+        i.setWd80(null);
+      }
+      if(i.getWd90().compareTo(nullBig)==0){
+        i.setWd90(null);
+      }
+      if(i.getWd100().compareTo(nullBig)==0){
+        i.setWd100(null);
+      }
+      if(i.getWd170().compareTo(nullBig)==0){
+        i.setWd170(null);
+      }
+
+    }
+
+  }
+
+
+  /**
+   * (统计查询:nwp风速统计(吉林22))
+   * @param startTime     开始时间
+   * @param endTime       结束时间
+   * @param statistics    统计类型
+   * @param wsHeight      层高
+   * @return
+   */
+  public List<Map<String, Object>> getWsStatistics( Long startTime,
+                                                    Long endTime,
+                                                    String statistics,
+                                                    Integer wsHeight) {
+    List<Map<String, Object>> resultList = new ArrayList<>();
+
+    List<NwpOne> nList = nwpOneRepository.findByPreTimeBetween(startTime, endTime);
+
+    List<Map<String, Float>> beforeFormatting = new ArrayList<>();
+    Map<String, List<Float>> afterFormatting = new HashMap<>();
+    String dateformat = "yyyyMMdd";
+
+    if (statistics.equals("month")) {
+      dateformat = "yyyyMM";
+    }
+
+    if (statistics.equals("year")) {
+      dateformat = "yyyy";
+    }
+
+
+    if (wsHeight == 10) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs10().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 30) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs30().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 50) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs50().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+
+    if (wsHeight == 70) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs70().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+
+    if (wsHeight == 80) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs80().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 90) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs90().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 100) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs100().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 170) {
+      for (NwpOne n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs170().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    Map<String, List<Float>> resultMap = new TreeMap<>((str1, str2) -> str1.compareTo(str2));
+    resultMap.putAll(afterFormatting);
+
+    for (String key : resultMap.keySet()) {
+      List<Float> n = afterFormatting.get(key);
+      Float maxValue = Collections.max(n);
+      Float minValue = Collections.min(n);
+      Float init = 0f;
+      BigDecimal sum = new BigDecimal(init);
+      for (int i = 0;i<n.size();i++){
+        BigDecimal value = new BigDecimal(n.get(i));
+        sum = sum.add(value);
+      }
+      BigDecimal size = new BigDecimal(n.size());
+      BigDecimal avgValue = sum.divide(size,4,BigDecimal.ROUND_HALF_UP);
+      BigDecimal topWs = new BigDecimal(maxValue).multiply(new BigDecimal(0.05)).add(new BigDecimal(maxValue)).setScale(4,BigDecimal.ROUND_HALF_UP);
+      Map<String,Object> map2 = new HashMap<>();
+      map2.put("time",key);
+      map2.put("wsHight",wsHeight);
+      map2.put("maxWs",maxValue);
+      map2.put("topWs",topWs.floatValue());
+      map2.put("minWs",minValue);
+      map2.put("avgWs",avgValue);
+      resultList.add(map2);
+    }
+
+
+    return resultList;
+  }
+
+
+
+
+  /**
+   * 用于实时对比查询
+   * 实时nwp数据
+   *
+   */
+  public List<NwpOne> findByPreTimeBetween(Long startTime, Long endTime, Long timeStep){
+    List<NwpOne> list = new ArrayList<>();
+    List<NwpOne> resultList = new ArrayList<>();
+
+    list = nwpOneRepository.findByPreTimeBetween(startTime,endTime);
+
+    if(startTime%timeStep !=0){
+      startTime = endTime -(startTime%timeStep);
+    }
+    for(long i = startTime;i<endTime;i=i+timeStep) {
+      long finalI =i;
+      List<NwpOne> w = list.stream().filter(t -> t.getPreTime() == finalI).collect(Collectors.toList());
+      if(w.size()>0){
+        resultList.add(w.get(0));
+      }
+    }
+
+    return resultList;
+  }
+
+  public List<NwpOne> findByTimeBetween(Long startTime,Long endTime){
+    List<NwpOne> nwpOneList = nwpOneRepository.findByPreTimeBetween(startTime,endTime);
+
+    Collections.sort(nwpOneList,Comparator.comparing(NwpOne::getPreTime));
+
+    return nwpOneList;
+  }
+
+
+  public int getNwpDay(){
+    int nwpDays = 3;
+    String days = super.getSysParameter("FILE_NWP_DAYS", "3");
+    try {
+      nwpDays = Integer.parseInt(days);
+    }catch (Exception e){
+      log.error("参数转换数据类型失败");
+      e.printStackTrace();
+    }
+    return nwpDays;
+  }
+}

+ 644 - 0
ipfcst/ipfcst-reportquery/src/main/java/com/jiayue/ipfcst/service/NwpTwoService.java

@@ -0,0 +1,644 @@
+package com.jiayue.ipfcst.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.core.util.CommonUtil;
+import com.jiayue.ipfcst.common.core.util.DateMomentUtil;
+import com.jiayue.ipfcst.common.data.entity.ElectricField;
+import com.jiayue.ipfcst.common.data.entity.NwpTwo;
+import com.jiayue.ipfcst.common.data.entity.SysParameter;
+import com.jiayue.ipfcst.common.data.repository.NwpTwoRepository;
+import com.jiayue.ipfcst.common.data.repository.SysParameterRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.time.DateFormatUtils;
+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.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * NWP实时业务层
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/8/5 16:02
+ */
+@Service
+@Slf4j
+public class NwpTwoService extends BaseService {
+
+  private final NwpTwoRepository nwpTwoRepository;
+
+  private final SysParameterRepository sysParameterRepository;
+  @Autowired
+  public NwpTwoService(NwpTwoRepository nwpTwoRepository, SysParameterRepository sysParameterRepository){
+    this.nwpTwoRepository = nwpTwoRepository;
+    this.sysParameterRepository = sysParameterRepository;
+  }
+  /**
+   * 按时间查询实时NWP yh
+   * @param startTime 开始时间
+   * @param endTime 结束时间
+   * @return 结果集
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String,Object> findByForecastTimeBetween(Long startTime, Long endTime) throws BusinessException {
+    Map<String,Object> map = new HashMap<>();
+    List<NwpTwo> list = new ArrayList<>();
+    List<NwpTwo> checkList = new ArrayList<>();
+    Map<String,Object> datas = new LinkedHashMap<>();
+    list = nwpTwoRepository.findByPreTimeBetween(startTime, endTime);
+    list.sort(Comparator.comparing(NwpTwo::getPreTime));
+
+    long startTimeLong  = startTime;
+    long endTimeLong  = endTime;
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    long timeStep = 900000L;
+    if(startTimeLong%timeStep !=0){
+      startTimeLong = startTimeLong -(startTimeLong%timeStep);
+    }
+    List<String> times = new ArrayList<>();
+
+    for(long i = startTimeLong;i<endTimeLong;i=i+timeStep){
+      long finalI = i;
+      List<NwpTwo> p = list.stream().filter(t -> t.getPreTime() == finalI).collect(Collectors.toList());
+      if (p != null && p.size() > 0) {
+        checkList.add(p.get(0));
+      }else{
+        checkList.add(new NwpTwo());
+      }
+      String timeFormat = sdf.format(new Date(i));
+      times.add(timeFormat);
+    }
+    this.defaultReplace(checkList);
+    ElectricField electricField = this.getElectricField();
+    List<BigDecimal> ws10Collect = new ArrayList<>();
+    List<BigDecimal> ws30Collect= new ArrayList<>();
+    List<BigDecimal> ws50Collect= new ArrayList<>();
+    List<BigDecimal> ws70Collect= new ArrayList<>();
+    List<BigDecimal> ws80Collect= new ArrayList<>();
+    List<BigDecimal> ws90Collect= new ArrayList<>();
+    List<BigDecimal> ws100Collect= new ArrayList<>();
+    List<BigDecimal> ws170Collect= new ArrayList<>();
+    List<BigDecimal> swrCollect= new ArrayList<>();
+    List<BigDecimal> diffuseRadiationCollect= new ArrayList<>();
+    List<BigDecimal> directRadiationCollect= new ArrayList<>();
+    Map<String,String> map1 = new HashMap<>();
+    if(electricField.getElectricFieldTypeEnum().getCode() == 1){
+      swrCollect = checkList.stream().map(NwpTwo::getSwr).collect(Collectors.toList());
+      diffuseRadiationCollect = checkList.stream().map(NwpTwo::getDiffuseRadiation).collect(Collectors.toList());
+      directRadiationCollect = checkList.stream().map(NwpTwo::getDirectRadiation).collect(Collectors.toList());
+      datas.put("swr",swrCollect);
+      datas.put("diffuseRadiation",diffuseRadiationCollect);
+      datas.put("directRadiation",directRadiationCollect);
+
+    }else{
+      ws10Collect = checkList.stream().map(NwpTwo::getWs10).collect(Collectors.toList());
+      ws30Collect = checkList.stream().map(NwpTwo::getWs30).collect(Collectors.toList());
+      ws50Collect = checkList.stream().map(NwpTwo::getWs50).collect(Collectors.toList());
+      ws70Collect = checkList.stream().map(NwpTwo::getWs70).collect(Collectors.toList());
+      ws80Collect = checkList.stream().map(NwpTwo::getWs80).collect(Collectors.toList());
+      ws90Collect = checkList.stream().map(NwpTwo::getWs90).collect(Collectors.toList());
+      ws100Collect = checkList.stream().map(NwpTwo::getWs100).collect(Collectors.toList());
+      ws170Collect = checkList.stream().map(NwpTwo::getWs170).collect(Collectors.toList());
+      datas.put("ws10",ws10Collect);
+      datas.put("ws30",ws30Collect);
+      datas.put("ws50",ws50Collect);
+      datas.put("ws70",ws70Collect);
+      datas.put("ws80",ws80Collect);
+      datas.put("ws90",ws90Collect);
+      datas.put("ws100",ws100Collect);
+      datas.put("ws170",ws170Collect);
+      try {
+        SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("NWP_CHANGE_WIND");
+        if (sysParameter != null) {
+          String nwpChangeWind = sysParameter.getSysValue();
+          String[] windChangeName = nwpChangeWind.split(",");
+          if (windChangeName.length == 16) {
+            map1.put("ws10",windChangeName[0]+"米风速");
+            map1.put("ws30",windChangeName[1]+"米风速");
+            map1.put("ws50",windChangeName[2]+"米风速");
+            map1.put("ws70",windChangeName[3]+"米风速");
+            map1.put("ws80",windChangeName[4]+"米风速");
+            map1.put("ws90",windChangeName[5]+"米风速");
+            map1.put("ws100",windChangeName[6]+"米风速");
+            map1.put("ws170",windChangeName[7]+"米风速");
+          }
+        }
+
+      } catch (RuntimeException e) {
+        String errorInfo = "NWP风速风向别名参数获取失败" + CommonUtil.printStackTraceToString(e);
+        log.error(errorInfo, e);
+      }
+      if (map1.isEmpty()){
+        map1.put("ws10","10米风速");
+        map1.put("ws30","30米风速");
+        map1.put("ws50","50米风速");
+        map1.put("ws70","70米风速");
+        map1.put("ws80","80米风速");
+        map1.put("ws90","90米风速");
+        map1.put("ws100","100米风速");
+        map1.put("ws170","170米风速");
+      }
+    }
+
+
+    map.put("cName",map1);
+    map.put("times",times);
+    map.put("datas",datas);
+    return map;
+  }
+
+
+
+  /**
+   * 根据时间 分页查询 NWP数据 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @param page      页码
+   * @param size      条数
+   * @param sortOrder 排序
+   * @return
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenAndNoForPaging(Long startTime, Long endTime,
+                                                             Integer page, Integer size,
+                                                             String sortOrder)  {
+    Map<String, Object> map = new HashMap<>();
+    Sort sort = Sort.by(Sort.Direction.DESC, "preTime");
+    if (sortOrder.contains("asc")) {
+      sort = Sort.by(Sort.Direction.ASC, "preTime");
+    }
+    Specification<NwpTwo> specification = this.specificationFindByTimeAndNo(startTime, endTime);
+    Pageable pageable = PageRequest.of(page - 1, size, sort);
+    Page nwps = nwpTwoRepository.findAll(specification,pageable);
+    List<NwpTwo> datas = new ArrayList<>();
+    datas = nwps.getContent();
+    this.defaultReplace(datas);
+    map.put("content", datas);
+    map.put("count", nwps.getTotalElements());
+    Map<String,String> map1 = new HashMap<>();
+
+    try {
+      SysParameter sysParameter = sysParameterRepository.findBySysKeyEquals("NWP_CHANGE_WIND");
+      if (sysParameter != null) {
+        String nwpChangeWind = sysParameter.getSysValue();
+        String[] windChangeName = nwpChangeWind.split(",");
+        if (windChangeName.length == 16) {
+          map1.put("preTime","预测时间");
+          map1.put("scTime","生成时间");
+          map1.put("pressure","气压(KPa)");
+          map1.put("t","温度(℃)");
+          map1.put("rh","湿度(%)");
+          map1.put("swr","总辐射(W/㎡)");
+          map1.put("directRadiation","直辐射(W/㎡)");
+          map1.put("diffuseRadiation","散辐射(W/㎡)");
+          map1.put("senf","热感通量(W/㎡)");
+          map1.put("ws10",windChangeName[0]+"米风速(m/s)");
+          map1.put("ws30",windChangeName[1]+"米风速(m/s)");
+          map1.put("ws50",windChangeName[2]+"米风速(m/s)");
+          map1.put("ws70",windChangeName[3]+"米风速(m/s)");
+          map1.put("ws80",windChangeName[4]+"米风速(m/s)");
+          map1.put("ws90",windChangeName[5]+"米风速(m/s)");
+          map1.put("ws100",windChangeName[6]+"米风速(m/s)");
+          map1.put("ws170",windChangeName[7]+"米风速(m/s)");
+          map1.put("wd10",windChangeName[8]+"米风向(°)");
+          map1.put("wd30",windChangeName[9]+"米风向(°)");
+          map1.put("wd50",windChangeName[10]+"米风向(°)");
+          map1.put("wd70",windChangeName[11]+"米风向(°)");
+          map1.put("wd80",windChangeName[12]+"米风向(°)");
+          map1.put("wd90",windChangeName[13]+"米风向(°)");
+          map1.put("wd100",windChangeName[14]+"米风向(°)");
+          map1.put("wd170",windChangeName[15]+"米风向(°)");
+        }
+      }
+    } catch (RuntimeException e) {
+      String errorInfo = "NWP风速风向别名参数获取失败" + CommonUtil.printStackTraceToString(e);
+      log.error(errorInfo, e);
+    }
+    if (map1.isEmpty()){
+      map1.put("preTime","预测时间");
+      map1.put("scTime","生成时间");
+      map1.put("pressure","气压(KPa)");
+      map1.put("t","温度(℃)");
+      map1.put("rh","湿度(%)");
+      map1.put("swr","总辐射(W/㎡)");
+      map1.put("directRadiation","直辐射(W/㎡)");
+      map1.put("diffuseRadiation","散辐射(W/㎡)");
+      map1.put("senf","热感通量(W/㎡)");
+      map1.put("ws10","10米风速(m/s)");
+      map1.put("ws30","30米风速(m/s)");
+      map1.put("ws50","50米风速(m/s)");
+      map1.put("ws70","70米风速(m/s)");
+      map1.put("ws80","80米风速(m/s)");
+      map1.put("ws90","90米风速(m/s)");
+      map1.put("ws100","100米风速(m/s)");
+      map1.put("ws170","170米风速(m/s)");
+      map1.put("wd10","10米风向(m/s)");
+      map1.put("wd30","30米风向(m/s)");
+      map1.put("wd50","50米风向(m/s)");
+      map1.put("wd70","70米风向(m/s)");
+      map1.put("wd80","80米风向(m/s)");
+      map1.put("wd90","90米风向(m/s)");
+      map1.put("wd100","100米风向(m/s)");
+      map1.put("wd170","170米风向(m/s)");
+    }
+    map.put("cName",map1);
+    //################  统计  ##################
+    int days = DateMomentUtil.getDaysBetweenTwoDate(startTime,endTime+1000);
+    List<NwpTwo> dataList = new ArrayList<>();
+    for (int i = 0 ; i < days; i++){
+      NwpTwo nwp = new NwpTwo();
+      List<NwpTwo> nwpTwoList = nwpTwoRepository.findByPreTimeBetween(startTime + ((long) i * 60 * 60 * 24 * 1000),startTime + ((long) (i+1) * 60 * 60 * 24 * 1000 - 1000));
+      BigDecimal t = new BigDecimal(0);
+      BigDecimal rh = new BigDecimal(0);
+      BigDecimal pressure = new BigDecimal(0);
+      BigDecimal swr = new BigDecimal(0);
+      BigDecimal lwr = new BigDecimal(0);
+      BigDecimal directRadiation = new BigDecimal(0);
+      BigDecimal diffuseRadiation = new BigDecimal(0);
+      BigDecimal senf = new BigDecimal(0);
+      BigDecimal ws10 = new BigDecimal(0);
+      BigDecimal ws30 = new BigDecimal(0);
+      BigDecimal ws50 = new BigDecimal(0);
+      BigDecimal ws70 = new BigDecimal(0);
+      BigDecimal ws80 = new BigDecimal(0);
+      BigDecimal ws90 = new BigDecimal(0);
+      BigDecimal ws100 = new BigDecimal(0);
+      BigDecimal ws170 = new BigDecimal(0);
+      BigDecimal wd10 = new BigDecimal(0);
+      BigDecimal wd30 = new BigDecimal(0);
+      BigDecimal wd50 = new BigDecimal(0);
+      BigDecimal wd70 = new BigDecimal(0);
+      BigDecimal wd80 = new BigDecimal(0);
+      BigDecimal wd90 = new BigDecimal(0);
+      BigDecimal wd100 = new BigDecimal(0);
+      BigDecimal wd170 = new BigDecimal(0);
+      for(int j = 0; j < nwpTwoList.size(); j++ ){
+          t = t.add(nwpTwoList.get(j).getT() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getT());
+          rh = rh.add(nwpTwoList.get(j).getRh() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getRh());
+          pressure = pressure.add(nwpTwoList.get(j).getPressure() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getPressure());
+          swr = swr.add(nwpTwoList.get(j).getSwr() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getSwr());
+          lwr = lwr.add(nwpTwoList.get(j).getLwr() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getLwr());
+          directRadiation = directRadiation.add(nwpTwoList.get(j).getDirectRadiation() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getDirectRadiation());
+          diffuseRadiation = diffuseRadiation.add(nwpTwoList.get(j).getDiffuseRadiation() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getDiffuseRadiation());
+          senf = senf.add(nwpTwoList.get(j).getSenf() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getSenf());
+          ws10 = ws10.add(nwpTwoList.get(j).getWs10() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs10());
+          ws30 = ws30.add(nwpTwoList.get(j).getWs30() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs30());
+          ws50 = ws50.add(nwpTwoList.get(j).getWs50() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs50());
+          ws70 = ws70.add(nwpTwoList.get(j).getWs70() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs70());
+          ws80 = ws80.add(nwpTwoList.get(j).getWs80() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs80());
+          ws90 = ws90.add(nwpTwoList.get(j).getWs90() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs90());
+          ws100 = ws100.add(nwpTwoList.get(j).getWs100() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs100());
+          ws170 = ws170.add(nwpTwoList.get(j).getWs170() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWs170());
+          wd10 = wd10.add(nwpTwoList.get(j).getWd10() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd10());
+          wd30 = wd30.add(nwpTwoList.get(j).getWd30() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd30());
+          wd50 = wd50.add(nwpTwoList.get(j).getWd50() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd50());
+          wd70 = wd70.add(nwpTwoList.get(j).getWd70() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd70());
+          wd80 = wd80.add(nwpTwoList.get(j).getWd80() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd80());
+          wd90 = wd90.add(nwpTwoList.get(j).getWd90() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd90());
+          wd100 = wd100.add(nwpTwoList.get(j).getWd100() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd100());
+          wd170 = wd170.add(nwpTwoList.get(j).getWd170() == null ? BigDecimal.valueOf(0) : nwpTwoList.get(j).getWd170());
+      }
+      if(nwpTwoList.size() > 0){
+        nwp.setScTime(nwpTwoList.get(0).getScTime());
+        nwp.setScDate(nwpTwoList.get(0).getScDate());
+        nwp.setPreTime(nwpTwoList.get(0).getPreTime());
+        nwp.setPreDate(nwpTwoList.get(0).getPreDate());
+        nwp.setFarmId(nwpTwoList.get(0).getFarmId());
+        nwp.setT(t.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : t.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setRh(rh.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : rh.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setPressure(pressure.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : pressure.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setSwr(swr.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : swr.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setLwr(lwr.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : lwr.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setDirectRadiation(directRadiation.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : directRadiation.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setDiffuseRadiation(diffuseRadiation.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : diffuseRadiation.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setSenf(senf.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : senf.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs10(ws10.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws10.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs30(ws30.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws30.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs50(ws50.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws50.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs70(ws70.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws70.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs80(ws80.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws80.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs90(ws90.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws90.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs100(ws100.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws100.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWs170(ws170.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : ws170.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd10(wd10.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd10.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd30(wd30.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd30.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd50(wd50.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd50.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd70(wd70.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd70.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd80(wd80.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd80.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd90(wd90.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd90.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd100(wd100.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd100.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        nwp.setWd170(wd170.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP).doubleValue() < 0d ? new BigDecimal(0) : wd170.divide(BigDecimal.valueOf(nwpTwoList.size()),2, BigDecimal.ROUND_HALF_UP));
+        dataList.add(nwp);
+      }
+    }
+
+    map.put("statistics", dataList);
+    return map;
+  }
+
+  /**
+   * 根据时间和编号 分页查询条件 yh
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 过滤条件
+   */
+  Specification<NwpTwo> specificationFindByTimeAndNo(final Long startTime, final Long endTime) {
+    return (Specification<NwpTwo>) (root, criteriaQuery, cb) -> {
+      List<Predicate> predicates = new ArrayList<>();
+      if (startTime!=null) {
+        //大于或等于传入时间
+        predicates.add(cb.greaterThanOrEqualTo(root.get("preTime").as(Long.class), startTime));
+      }
+      if (endTime!=null) {
+        //小于传入时间
+        predicates.add(cb.lessThan(root.get("preTime").as(Long.class), endTime));
+      }
+
+      //添加排序的功能
+      return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+
+    };
+  }
+
+  /**
+   *  对集合进行 -99替换null操作,主要用于图标展示空值
+   *
+   * @param datas  需要替换集合
+   */
+  public void defaultReplace(List<NwpTwo> datas){
+    BigDecimal nullBig =  new BigDecimal(-99);
+    for(NwpTwo i :datas){
+
+
+      if(i.getT().compareTo(nullBig)==0){
+        i.setT(null);
+      }
+      if(i.getRh().compareTo(nullBig)==0){
+        i.setRh(null);
+      }
+      if(i.getPressure().compareTo(nullBig)==0){
+        i.setPressure(null);
+      }
+      if(i.getSwr().compareTo(nullBig)==0){
+        i.setSwr(null);
+      }
+      if(i.getDirectRadiation().compareTo(nullBig)==0){
+        i.setDirectRadiation(null);
+      }
+      if(i.getDiffuseRadiation().compareTo(nullBig)==0){
+        i.setDiffuseRadiation(null);
+      }
+      if(i.getSenf().compareTo(nullBig)==0){
+        i.setSenf(null);
+      }
+      if(i.getWs10().compareTo(nullBig)==0){
+        i.setWs10(null);
+      }
+      if(i.getWs30().compareTo(nullBig)==0){
+        i.setWs30(null);
+      }
+      if(i.getWs50().compareTo(nullBig)==0){
+        i.setWs50(null);
+      }
+      if(i.getWs70().compareTo(nullBig)==0){
+        i.setWs70(null);
+      }
+      if(i.getWs80().compareTo(nullBig)==0){
+        i.setWs80(null);
+      }
+      if(i.getWs90().compareTo(nullBig)==0){
+        i.setWs90(null);
+      }
+      if(i.getWs100().compareTo(nullBig)==0){
+        i.setWs100(null);
+      }
+      if(i.getWs170().compareTo(nullBig)==0){
+        i.setWs170(null);
+      }
+      if(i.getWd10().compareTo(nullBig)==0){
+        i.setWd10(null);
+      }
+      if(i.getWd30().compareTo(nullBig)==0){
+        i.setWd30(null);
+      }
+      if(i.getWd50().compareTo(nullBig)==0){
+        i.setWd50(null);
+      }
+      if(i.getWd70().compareTo(nullBig)==0){
+        i.setWd70(null);
+      }
+      if(i.getWd80().compareTo(nullBig)==0){
+        i.setWd80(null);
+      }
+      if(i.getWd90().compareTo(nullBig)==0){
+        i.setWd90(null);
+      }
+      if(i.getWd100().compareTo(nullBig)==0){
+        i.setWd100(null);
+      }
+      if(i.getWd170().compareTo(nullBig)==0){
+        i.setWd170(null);
+      }
+
+    }
+
+  }
+
+
+  /**
+   * (统计查询:nwp风速统计(吉林22))
+   * @param startTime     开始时间
+   * @param endTime       结束时间
+   * @param statistics    统计类型
+   * @param wsHeight      层高
+   * @return
+   */
+  public List<Map<String, Object>> getWsStatistics( Long startTime,
+                                                    Long endTime,
+                                                    String statistics,
+                                                    Integer wsHeight) {
+    List<Map<String, Object>> resultList = new ArrayList<>();
+
+    List<NwpTwo> nList = nwpTwoRepository.findByPreTimeBetween(startTime, endTime);
+
+    List<Map<String, Float>> beforeFormatting = new ArrayList<>();
+    Map<String, List<Float>> afterFormatting = new HashMap<>();
+    String dateformat = "yyyyMMdd";
+
+    if (statistics.equals("month")) {
+      dateformat = "yyyyMM";
+    }
+
+    if (statistics.equals("year")) {
+      dateformat = "yyyy";
+    }
+
+
+    if (wsHeight == 10) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs10().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 30) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs30().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 50) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs50().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+
+    if (wsHeight == 70) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs70().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+
+    if (wsHeight == 80) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs80().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 90) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs90().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 100) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs100().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    if (wsHeight == 170) {
+      for (NwpTwo n : nList) {
+        Map<String, Float> map1 = new HashMap();
+        map1.put(DateFormatUtils.format(n.getPreTime(), dateformat), n.getWs170().floatValue());
+        beforeFormatting.add(map1);
+      }
+      afterFormatting = beforeFormatting.stream().flatMap(m -> m.entrySet().stream()).collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
+
+    }
+    Map<String, List<Float>> resultMap = new TreeMap<>((str1, str2) -> str1.compareTo(str2));
+    resultMap.putAll(afterFormatting);
+
+    for (String key : resultMap.keySet()) {
+      List<Float> n = afterFormatting.get(key);
+      Float maxValue = Collections.max(n);
+      Float minValue = Collections.min(n);
+      Float init = 0f;
+      BigDecimal sum = new BigDecimal(init);
+      for (int i = 0;i<n.size();i++){
+        BigDecimal value = new BigDecimal(n.get(i));
+        sum = sum.add(value);
+      }
+      BigDecimal size = new BigDecimal(n.size());
+      BigDecimal avgValue = sum.divide(size,4,BigDecimal.ROUND_HALF_UP);
+      BigDecimal topWs = new BigDecimal(maxValue).multiply(new BigDecimal(0.05)).add(new BigDecimal(maxValue)).setScale(4,BigDecimal.ROUND_HALF_UP);
+      Map<String,Object> map2 = new HashMap<>();
+      map2.put("time",key);
+      map2.put("wsHight",wsHeight);
+      map2.put("maxWs",maxValue);
+      map2.put("topWs",topWs.floatValue());
+      map2.put("minWs",minValue);
+      map2.put("avgWs",avgValue);
+      resultList.add(map2);
+    }
+
+
+    return resultList;
+  }
+
+
+
+
+  /**
+   * 用于实时对比查询
+   * 实时nwp数据
+   *
+   */
+  public List<NwpTwo> findByPreTimeBetween(Long startTime, Long endTime, Long timeStep){
+    List<NwpTwo> list = new ArrayList<>();
+    List<NwpTwo> resultList = new ArrayList<>();
+
+    list = nwpTwoRepository.findByPreTimeBetween(startTime,endTime);
+
+    if(startTime%timeStep !=0){
+      startTime = endTime -(startTime%timeStep);
+    }
+    for(long i = startTime;i<endTime;i=i+timeStep) {
+      long finalI =i;
+      List<NwpTwo> w = list.stream().filter(t -> t.getPreTime() == finalI).collect(Collectors.toList());
+      if(w.size()>0){
+        resultList.add(w.get(0));
+      }
+    }
+
+    return resultList;
+  }
+
+  public List<NwpTwo> findByTimeBetween(Long startTime,Long endTime){
+    List<NwpTwo> nwpTwoList = nwpTwoRepository.findByPreTimeBetween(startTime,endTime);
+
+    Collections.sort(nwpTwoList,Comparator.comparing(NwpTwo::getPreTime));
+
+    return nwpTwoList;
+  }
+
+
+  public int getNwpDay(){
+    int nwpDays = 3;
+    String days = super.getSysParameter("FILE_NWP_DAYS", "3");
+    try {
+      nwpDays = Integer.parseInt(days);
+    }catch (Exception e){
+      log.error("参数转换数据类型失败");
+      e.printStackTrace();
+    }
+    return nwpDays;
+  }
+}