瀏覽代碼

Merge remote-tracking branch 'origin/master'

wangtao 3 年之前
父節點
當前提交
d3d74b99fa

+ 7 - 4
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/abst/equipmentstatus/AbstractEquipmentStatusData.java

@@ -30,12 +30,11 @@ public class AbstractEquipmentStatusData implements Serializable {
     @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
     @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
     private Integer id;
-
     /**
-     * 设备编号
+     * 设备主键ID
      */
     @Column
-    private String equipmentNo;
+    private String equipmentId;
 
     /**
      * 状态
@@ -134,5 +133,9 @@ public class AbstractEquipmentStatusData implements Serializable {
     @Column
     private BigDecimal data10 = new BigDecimal(-99);
 
-
+    /**
+     * 场站编号
+     */
+    @Column
+    private String stationCode;
 }

+ 2 - 2
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/InverterStatusDataRepository.java

@@ -16,6 +16,6 @@ public interface InverterStatusDataRepository extends BaseRepository<InverterSta
 
 
     List<InverterStatusData> findByTimeBetween(Date startTime, Date endTime);
-    List<InverterStatusData> findByTimeBetweenAndEquipmentNoIn(Date startTime, Date endTime, Integer[] no);
-    List<InverterStatusData> findByTimeBetweenAndEquipmentNo(Date startTime, Date endTime, String no);
+    List<InverterStatusData> findByTimeBetweenAndEquipmentIdIn(Date startTime, Date endTime, Integer[] no);
+    List<InverterStatusData> findByTimeBetweenAndEquipmentId(Date startTime, Date endTime, String no);
 }

+ 1 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/WeatherStationStatusDataRepository.java

@@ -21,6 +21,6 @@ public interface WeatherStationStatusDataRepository extends BaseRepository<Weath
 	 * @param endTime   结束时间
 	 * @param no        设备编号
 	 */
-	List<WeatherStationStatusData> findByTimeBetweenAndEquipmentNo(Date startTime, Date endTime, String no);
+	List<WeatherStationStatusData> findByTimeBetweenAndEquipmentId(Date startTime, Date endTime, String no);
 
 }

+ 1 - 1
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/WindTowerStatusDataRepository.java

@@ -23,5 +23,5 @@ public interface WindTowerStatusDataRepository extends JpaRepository<WindTowerSt
 	 * @param endTime
 	 * @return
 	 */
-	List<WindTowerStatusData> findByEquipmentNoAndTimeBetween(String equipmentNo, Date startTime, Date endTime);
+	List<WindTowerStatusData> findByEquipmentIdAndTimeBetween(String equipmentNo, Date startTime, Date endTime);
 }

+ 2 - 2
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/WindTurbineStatusDataRepository.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 public interface WindTurbineStatusDataRepository extends BaseRepository<WindTurbineStatusData, Integer> {
     List<WindTurbineStatusData> findByTimeBetween(Date startTime, Date endTime);
-    List<WindTurbineStatusData> findByTimeBetweenAndEquipmentNo(Date startTime, Date endTime, String no);
+    List<WindTurbineStatusData> findByTimeBetweenAndEquipmentId(Date startTime, Date endTime, String no);
 
-    List<WindTurbineStatusData> findByTimeBetweenAndEquipmentNoIn(Date startTime, Date endTime, Integer[] no);
+    List<WindTurbineStatusData> findByTimeBetweenAndEquipmentIdIn(Date startTime, Date endTime, Integer[] no);
 }

+ 2 - 0
ipfcst-console/src/main/frontend/router/index.js

@@ -9,6 +9,7 @@ import Layout from '@/layout'
 import consoleRouter from './modules/console'
 import systemRouter from './modules/system'
 import uploadRouter from './modules/uploadFile';
+import dataqueryRouter from './modules/dataquery';
 
 /**
  * Note: sub-menu only appear when route children.length >= 1
@@ -63,6 +64,7 @@ export const constantRoutes = [
   consoleRouter,
   systemRouter,
   uploadRouter,
+  dataqueryRouter,
   {
     path: '/ftp',
     component: Layout,

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

@@ -0,0 +1,288 @@
+<template>
+  <div class="chart-container">
+    <div class="filter">
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" @change="stationCodeChange">
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <span style="font-weight: bold;font-size: 14px">设备名称:</span>
+      <el-select v-model="inverterInfoId" clearable placeholder="请选择">
+        <el-option
+          v-for="item in inverterInfos"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id">
+        </el-option>
+      </el-select>
+      <span style="font-weight: bold;font-size: 14px">起始时间:</span>
+        <el-date-picker
+          v-model="startTime"
+          :clearable="false"
+          type="datetime"
+          value-format="timestamp"
+          placeholder="选择日期">
+        </el-date-picker>
+      <span style="font-weight: bold;font-size: 14px">截止时间:</span>
+        <el-date-picker
+          v-model="endTime"
+          :clearable="false"
+          type="datetime"
+          value-format="timestamp"
+          placeholder="选择日期">
+        </el-date-picker>
+        <el-button  :loading=loading  size="small"  @click="dateQuery">查询</el-button>
+    </div>
+    <div class="content">
+      <!--<el-tabs type="card" v-model="activeName" >-->
+      <!--<el-tab-pane  label="指定逆变器" name="first">-->
+      <div class="tableContent">
+        <vxe-table
+          id="inverterNoTable"
+          ref="inTable"
+          :loading="loading"
+          border
+          @sort-change="sortChangeEventNo"
+          :auto-resize="true"
+          highlight-hover-row
+          :header-cell-style="{background:'black',color:'white',border:'white'}"
+          max-height="90%"
+          :resizable="true"
+          :cell-style="{background:'black',color:'white'}"
+          align="center"
+          :data="inverterStatusDataNo">
+          <vxe-table-column  field="time" title="接收时间" :formatter="dateFormat" min-width="150" sortable ></vxe-table-column>
+          <vxe-table-column field="equipmentId" title="名称" min-width="60" :formatter="nameFormat"></vxe-table-column>
+          <vxe-table-column field="activePower" title="有功(KW)" min-width="60"></vxe-table-column>
+          <vxe-table-column field="reactivePower" title="无功(KW)" min-width="60"></vxe-table-column>
+          <vxe-table-column field="powerFactor" title="功率因数" min-width="60"></vxe-table-column>
+          <vxe-table-column field="voltage" title="电压(V)" min-width="60"></vxe-table-column>
+          <vxe-table-column field="electricalCurrent" title="电流(A)" min-width="60"></vxe-table-column>
+          <vxe-table-column field="dayElectricQuantity" title="当日发电量(kW·h)" min-width="60"></vxe-table-column>
+          <vxe-table-column field="dayGridConnectedHours" title="当日并网小时"min-width="60"></vxe-table-column>
+          <vxe-table-column field="status" title="状态"min-width="60"></vxe-table-column>
+        </vxe-table>
+        <div class="rtPageturning">
+          <div class="toolbar">
+            <vxe-toolbar ref="fstToolBar" >
+              <template v-slot:buttons>
+                <vxe-button style="background:transparent;border:none"  @click="exportDataEvent"><i class="vxe-icon--download" style="color: white"></i></vxe-button>
+              </template>
+            </vxe-toolbar></div>
+          <vxe-pager
+            background
+            :loading="loading"
+            :current-page.sync="currentPageNo"
+            :page-size.sync="pageSizeNo"
+            :total="totalNo"
+            @page-change="handlePageChangeNo"
+            :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+          </vxe-pager>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+
+  export default {
+    data(){
+      return{
+        stationCode: '',
+        stationList: [],
+        loading:false,
+        queryStartTime:"",
+        queryEndTime:"",
+        startTime:new Date(new Date().toLocaleDateString()).getTime(),
+        endTime:new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000-1,
+        inverterInfoId:[],
+        inverterInfos:[],
+        inverterStatusDataNo:[],
+        inverterStatusDataAll:[],
+        activeName: 'first',
+        totalNo:0,
+        pageSizeNo: 10,
+        currentPageNo: 1,
+        sortOrderNo:'asc',
+        totalAll:0,
+        pageSizeAll: 10,
+        currentPageAll: 1,
+        sortOrderTime:'asc',
+        sortOrderNumber:'asc',
+      }
+    },
+    created () {
+      this.$nextTick(() => {
+        // 手动将表格和工具栏进行关联
+        this.$refs.inTable.connect(this.$refs.inverterToolbar)
+        // this.$refs.iaTable.connect(this.$refs.inverterAllToolbar)
+      })
+    },
+    mounted(){
+      this.getStationList()
+    },
+    methods:{
+      stationCodeChange() {
+        // 获取逆变器设备
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          // 清除设备下拉框
+          this.inverterInfos = ''
+        }
+        else{
+          this.$axios.get('/findInverterInfoByStation/' + queryParam).then((res) => {
+            this.inverterInfos = res.data
+          })
+        }
+      },
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
+      queryInverterDataNo(){
+        this.loading=true
+        let inverterId = this.inverterInfoId;
+        if (inverterId==''){
+          inverterId="ALL"
+        }
+        this.$axios.get('/inverterStatusData/'+this.stationCode+'/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.currentPageNo+'/'+this.pageSizeNo+'/'+inverterId).then((res) => {
+          this.inverterStatusDataNo = res.data.content
+          // 表分页格数据总条数
+          this.totalNo = res.data.count
+          this.loading=false
+        }).catch((error) => {
+          this.loading=false
+          this.$message.error('查询逆变器根据number出错' + error)
+        })
+      },
+      dateQuery(){
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          this.$message.error("请选择场站")
+          return;
+        }
+        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*3){
+          this.startTime = this.queryStartTime
+          this.endTime = this.queryEndTime
+          this.$message.error("只能最多查询3天的数据")
+          this.loading = false
+          return
+        }
+        if(this.windTurbineInfoId=="") {
+          this.$message.error("设备选项不能为空")
+          this.loading=false
+          return
+        }
+
+        this.queryStartTime = this.startTime
+        this.queryEndTime = this.endTime
+        this.currentPageNo = 1
+        this.queryInverterDataNo()
+        this.currentPageAll = 1
+      },
+      sortChangeEventNo ({ column, property, order }) {
+        if(order == null){
+          order = 'asc'
+        }
+        this.currentPageNo = 1
+        this.sortOrderNo = order
+        this.queryInverterDataNo()
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },
+      sortChangeEventAll ({ column, property, order }) {
+        if(order == null){
+          order = 'asc'
+        }
+
+        if(property == 'time'){
+          this.sortOrderTime = order
+        }
+
+        if(property == 'equipmentNo'){
+          this.sortOrderNumber = order
+        }
+        this.currentPageAll = 1
+        // this.queryInverterDataAll()
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+      },
+      checkColumnMethod ({ column }) {
+        if (column.property === 'time') {
+          return false
+        }
+        return true
+      },
+      dateFormat({ cellValue, row, column }) {
+        const date = new Date(cellValue) // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
+        const Y = date.getFullYear() + '-'
+        const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
+        const D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '    '
+        const H = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':'
+        const m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':'
+        const s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())
+        return Y + M + D + H + m + s
+      },
+      nameFormat({ cellValue, row, column }) {
+        var name ='未知设备'
+        for(let index in this.inverterInfos) {
+          if(cellValue == this.inverterInfos[index].id){
+            name = this.inverterInfos[index].name
+          }
+        };
+        return name
+      },
+      handlePageChangeNo ({ currentPage, pageSize }) {
+        this.currentPageNo = currentPage
+        this.pageSizeNo = pageSize
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+        this.queryInverterDataNo();
+      },
+      handlePageChangeAll({ currentPage, pageSize }){
+        this.currentPageAll = currentPage
+        this.pageSizeAll = pageSize
+        this.startTime = this.queryStartTime
+        this.endTime = this.queryEndTime
+        // this.queryInverterDataAll();
+      },
+      exportDataEvent() {
+        this.loading = true
+        this.$axios.get('/export/inverterStatusData/'+this.queryStartTime+'/'+this.queryEndTime+'/'+this.inverterInfoId, {
+          responseType: 'blob'// 用于解决中文乱码
+        }).then((response) => {
+          this.loading = false
+        }).catch((error) => {
+          this.loading = false
+          this.$message.error('导出失败' + error)
+        })
+      },
+    }
+  }
+</script>
+
+<style scoped>
+
+  .my_table_insert .vxe-body--row.is--new {
+    background-color: #f1fdf1;
+  }
+</style>
+

+ 17 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java

@@ -2,15 +2,14 @@ package com.jiayue.ipfcst.console.controller;
 
 import com.jiayue.ipfcst.aop.SaveValidate;
 import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
-import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.InverterInfo;
-import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
 import com.jiayue.ipfcst.console.service.InverterInfoService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -138,7 +137,22 @@ public class InverterInfoController {
 
     }
 
-
+  /**
+   * 查询所有逆变器设备信息按ID排序 yh
+   * @return 结果集
+   */
+  @GetMapping(value = "findInverterInfoByStation/{stationCode}")
+  public ResponseVO findInverterInfoByStation(@PathVariable("stationCode") String stationCode){
+    List<InverterInfo> list = new ArrayList<>();
+    try{
+      list = inverterInfoService.getByStationCode(stationCode);
+      return ResponseVO.success(list);
+    }catch(Exception e){
+      e.printStackTrace();
+      log.error("逆变器信息所有查询错误");
+      return ResponseVO.fail(e.toString());
+    }
+  }
 }
 
 

+ 4 - 9
ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/service/E63UploadFileService.java

@@ -458,8 +458,6 @@ public class E63UploadFileService extends BaseUploadFileService {
     List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
     if (!weatherStationInfos.isEmpty()) {
       String qxzId = String.valueOf(weatherStationInfos.get(0).getId());
-      // 设备编号
-      String equipmentNo = String.valueOf(weatherStationInfos.get(0).getEquipmentNo());
       Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + qxzId);
       // 数据格式化
       DecimalFormat df = new DecimalFormat("0.00");
@@ -495,7 +493,7 @@ public class E63UploadFileService extends BaseUploadFileService {
       }
 
       if (!isUseRedis) {
-        List<WeatherStationStatusData> weatherStationStatusDataList = weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime), equipmentNo);
+        List<WeatherStationStatusData> weatherStationStatusDataList = weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentId(new Date(startTime), new Date(endTime), qxzId);
         if (weatherStationStatusDataList.isEmpty()){
           // 总辐射产生500-1000随机数
           globalR = qxzRandomCreate("globalR");
@@ -572,7 +570,6 @@ public class E63UploadFileService extends BaseUploadFileService {
     List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
     if (!filterWindTowerInfoList.isEmpty()) {
       String cftId = String.valueOf(filterWindTowerInfoList.get(0).getId());
-      String equipmentNo = String.valueOf(filterWindTowerInfoList.get(0).getEquipmentNo());
       Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + cftId);
       // 数据格式化
       DecimalFormat df = new DecimalFormat("0.00");
@@ -631,7 +628,7 @@ public class E63UploadFileService extends BaseUploadFileService {
         }
       }
       if (!isUseRedis) {
-        List<WindTowerStatusData> windTowerStatusDataList = windTowerStatusDataRepository.findByEquipmentNoAndTimeBetween(equipmentNo, new Date(startTime), new Date(endTime));
+        List<WindTowerStatusData> windTowerStatusDataList = windTowerStatusDataRepository.findByEquipmentIdAndTimeBetween(cftId, new Date(startTime), new Date(endTime));
         if (windTowerStatusDataList.isEmpty()){
           // 没有测风塔数据用nwp数据补
           Long nwpTime;
@@ -900,7 +897,6 @@ public class E63UploadFileService extends BaseUploadFileService {
         map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
 
         String fjId = String.valueOf(windTurbineInfo.getId());
-        String equipmentNo = String.valueOf(windTurbineInfo.getEquipmentNo());
         Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + fjId);
         DecimalFormat df = new DecimalFormat("0.00");
 
@@ -980,7 +976,7 @@ public class E63UploadFileService extends BaseUploadFileService {
           }
         }
         if (!isUseRedis){
-          List<WindTurbineStatusData> windTurbineStatusDataList = windTurbineStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
+          List<WindTurbineStatusData> windTurbineStatusDataList = windTurbineStatusDataRepository.findByTimeBetweenAndEquipmentId(new Date(startTime), new Date(endTime),fjId);
           if (!windTurbineStatusDataList.isEmpty()){
             windTurbineStatusDataList.stream().sorted(Comparator.comparing(WindTurbineStatusData::getTime).reversed()).collect(Collectors.toList());
             WindTurbineStatusData windTurbineStatusData = windTurbineStatusDataList.get(0);
@@ -1094,7 +1090,6 @@ public class E63UploadFileService extends BaseUploadFileService {
         //是否组串
         map.put("IsString", inverterInfo.getGroupSeries() ? "1" : "0");
         String nbqId = String.valueOf(inverterInfo.getId());
-        String equipmentNo = String.valueOf(inverterInfo.getEquipmentNo());
         Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + nbqId);
         DecimalFormat df = new DecimalFormat("0.00");
         // 状态
@@ -1149,7 +1144,7 @@ public class E63UploadFileService extends BaseUploadFileService {
         }
 
         if (!isUseRedis){
-          List<InverterStatusData> inverterStatusDataList = inverterStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
+          List<InverterStatusData> inverterStatusDataList = inverterStatusDataRepository.findByTimeBetweenAndEquipmentId(new Date(startTime), new Date(endTime),nbqId);
           if (!inverterStatusDataList.isEmpty()){
             inverterStatusDataList.stream().sorted(Comparator.comparing(InverterStatusData::getTime).reversed()).collect(Collectors.toList());
             InverterStatusData inverterStatusData = inverterStatusDataList.get(0);