Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

tl 9 hónapja
szülő
commit
5519619a92

+ 4 - 4
cpp-admin/src/main/java/com/cpp/web/controller/configManager/InverterInfoController.java

@@ -142,14 +142,14 @@ public class InverterInfoController {
         return R.ok(list);
     }
 
-    @GetMapping("/all")
+    @GetMapping("/findAll")
     public R findAll() {
         List<InverterInfo> inverterInfoList = inverterInfoService.list();
-        List<Map<String, String>> list = new ArrayList<>();
+        List<Map<String, Object>> list = new ArrayList<>();
         for (InverterInfo e : inverterInfoList) {
-            Map<String, String> map = new HashMap<>();
+            Map<String, Object> map = new HashMap<>();
             map.put("label", e.getName());
-            map.put("value", e.getId()+"");
+            map.put("value", e.getId());
             list.add(map);
         }
         return R.ok(list);

+ 66 - 0
cpp-admin/src/main/java/com/cpp/web/controller/stationDataQuery/InverterStatusDataController.java

@@ -0,0 +1,66 @@
+package com.cpp.web.controller.stationDataQuery;
+
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.cpp.common.core.domain.R;
+import com.cpp.web.domain.station.InverterStatusData;
+import com.cpp.web.service.station.InverterStatusDataService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+
+/**
+ * idp_inverter_status_data
+ *
+ * @author whc
+ * @date 2022-03-18 15:49:14
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/inverterstatusdata")
+@Api(value = "inverterstatusdata", tags = "idp_inverter_status_data管理")
+public class InverterStatusDataController {
+
+    private final InverterStatusDataService inverterStatusDataService;
+
+    /**
+     * 分页查询
+     *
+     * @param page               分页对象
+     * @param inverterStatusData idp_inverter_status_data
+     * @return
+     */
+    @ApiOperation(value = "分页查询", notes = "分页查询")
+    @GetMapping("/page")
+    public R getInverterStatusDataPage(Page page, InverterStatusData inverterStatusData) {
+        return R.ok(inverterStatusDataService.page(page, Wrappers.query(inverterStatusData)));
+    }
+
+    /**
+     * 根据场站编号和设备ID分页查询
+     *
+     * @param currentPage
+     * @param pageSize
+     * @param stationCode 场站编号
+     * @param equipmentId 设备id
+     * @param startTime   开始时间
+     * @param endTime     结束时间
+     * @return
+     */
+    @ApiOperation(value = "根据场站编号和设备ID和时间范围分页查询", notes = "分页查询")
+    @GetMapping("/getByStationCodeAndEquipmentIdAndTimeBetween")
+    public R getByStationCodeAndEquipmentIdAndTimeBetween(Long currentPage, Long pageSize, String stationCode, String equipmentId, Long startTime, Long endTime) {
+        Page page = new Page(currentPage, pageSize);
+        page.addOrder(OrderItem.asc("time"));
+        page.setMaxLimit((long) -1);
+        return R.ok(inverterStatusDataService.page(page, inverterStatusDataService.getByStationCodeAndEquipmentIdAndTimeBetween(stationCode, equipmentId, new Date(startTime), new Date(endTime))));
+    }
+}

+ 2 - 2
cpp-admin/src/main/java/com/cpp/web/service/station/impl/InverterStatusDataServiceImpl.java

@@ -7,6 +7,7 @@ import com.cpp.web.mapper.station.InverterStatusDataMapper;
 import com.cpp.web.service.station.InverterStatusDataService;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.Date;
 
 /**
@@ -23,9 +24,8 @@ public class InverterStatusDataServiceImpl extends ServiceImpl<InverterStatusDat
         if (stationCode != null && !stationCode.equals("")) {
             wrapper.eq("station_code", stationCode);
         }
-        String[] args = equipmentId.split(",");
         if (equipmentId != null && !equipmentId.equals("")) {
-            wrapper.in("equipment_id", args);
+            wrapper.in("equipment_id", Arrays.asList(equipmentId.split(",")));
         }
         if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
             wrapper.between("time", startTime, endTime);

+ 2 - 1
cpp-admin/src/main/java/com/cpp/web/service/station/impl/WindTurbineStatusDataServiceImpl.java

@@ -9,6 +9,7 @@ import com.cpp.web.service.station.WindTurbineStatusDataService;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -28,7 +29,7 @@ public class WindTurbineStatusDataServiceImpl extends ServiceImpl<WindTurbineSta
         }
 
         if (equipmentId != null && !equipmentId.equals("")) {
-            wrapper.in("equipment_id", equipmentId);
+            wrapper.in("equipment_id", Arrays.asList(equipmentId.split(",")));
         }
         if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
             wrapper.between("time", startTime, endTime);

+ 154 - 161
cpp-ui/src/views/stationDataQuery/inverterstatusdata/index.vue

@@ -1,197 +1,190 @@
-<!--
-  -    Copyright (c) 2018-2025, lengleng All rights reserved.
-  -
-  - Redistribution and use in source and binary forms, with or without
-  - modification, are permitted provided that the following conditions are met:
-  -
-  - Redistributions of source code must retain the above copyright notice,
-  - this list of conditions and the following disclaimer.
-  - Redistributions in binary form must reproduce the above copyright
-  - notice, this list of conditions and the following disclaimer in the
-  - documentation and/or other materials provided with the distribution.
-  - Neither the name of the pig4cloud.com developer nor the names of its
-  - contributors may be used to endorse or promote products derived from
-  - this software without specific prior written permission.
-  - Author: lengleng (wangiegie@gmail.com)
-  -->
 <template>
-  <div class="execution">
-    <div style="display: inline-block">
-      <div class="startTime" style="display: inline-block">
-        <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;起始时间:</span>
+  <div class="app-container">
+    <el-form ref="queryForm" size="small" :inline="true">
+      <el-form-item label="时间">
         <el-date-picker
-          v-model="startTime"
+          size="mini"
           :clearable="false"
-          type="datetime"
-          value-format="timestamp"
-          placeholder="选择日期">
-        </el-date-picker>
-      </div>
-      <div class="endTime" style="display: inline-block">
-        <span class="timeText" style="font-weight: bold;font-size: 14px">&#12288;截止时间:</span>
-        <el-date-picker
-          v-model="endTime"
-          :clearable="false"
-          type="datetime"
-          value-format="timestamp"
-          placeholder="选择日期">
-        </el-date-picker>
-      </div>
-      <span style="font-weight: bold;font-size: 14px">&#12288;场站名称:</span>
-      <el-select style="width:250px" v-model="stationCode" @change="getAllInverterInfo" size="small">
-        <el-option
-          v-for="item in stationList"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
-          <span style="float: left">{{ item.label }}</span>
-          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
-        </el-option>
-      </el-select>
-      &nbsp;
-      <span style="font-weight: bold;font-size: 14px">&#12288;所属设备:</span>
-      <el-select style="width:250px" v-model="equipmentId" filterable size="small">
-        <el-option
-          v-for="item in inverterInfoList"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value">
-          <span style="float: left">{{ item.label }}</span>
-          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.value }}</span>
-        </el-option>
-      </el-select>
-      &nbsp;
-      <div class="timeQuery" style="display: inline-block">
-        <el-button size="small" :loading="loading" @click="dateQuery">查询</el-button>
-      </div>
+          v-model="dateTime"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+          :default-time="['00:00:00', '23:45:00']"
+        />
+      </el-form-item>
+      <el-form-item label="场站名称">
+        <el-select v-model="stationCode" placeholder="请选择" @change="stationChange">
+          <el-option
+            v-for="item in stationList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="逆变器设备">
+        <el-select size="mini" v-model="equipmentId"  multiple filterable>
+          <el-option
+            v-for="item in equipmentOptions"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" size="mini" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <div style="padding-top: 10px">
+      <vxe-table
+        ref="xTable"
+        align="center"
+        class="mytable-style"
+        auto-resize
+        border
+        resizable
+        export-config
+        highlight-current-row
+        show-overflow
+        max-height="700"
+        :data="tableData"
+        :radio-config="{trigger: 'row'}">
+        <vxe-column type="radio" width="60"/>
+        <vxe-table-column field="stationCode" title="所属场站" :formatter="stationCodeFormat"></vxe-table-column>
+        <vxe-table-column field="equipmentId" title="设备名称" :formatter="nameFormat"></vxe-table-column>
+        <vxe-table-column field="status" title="状态" :formatter="statusFormat"></vxe-table-column>
+        <vxe-table-column field="time" title="时间"></vxe-table-column>
+        <vxe-table-column field="activePower" title="有功(KW)"></vxe-table-column>
+        <vxe-table-column field="reactivePower" title="无功(KVar)"></vxe-table-column>
+        <vxe-table-column field="voltage" title="电压(V)"></vxe-table-column>
+        <vxe-table-column field="electricalCurrent" title="电流(A)"></vxe-table-column>
+        <vxe-table-column field="dayElectricQuantity" title="当日发电量(kW·h)"></vxe-table-column>
+        <vxe-table-column field="cumulativeGeneratedEnergy" title="累积发电量(MW·h)"></vxe-table-column>
+        <vxe-table-column field="dayGridConnectedHours" title="当日并网小时数"></vxe-table-column>
+      </vxe-table>
+      <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>
-    <basic-container>
-      <avue-crud ref="crud"
-                 :page.sync="page"
-                 :data="tableData"
-                 :table-loading="tableLoading"
-                 :option="tableOption"
-                 @on-load="getGridOnloadData">
-      </avue-crud>
-    </basic-container>
   </div>
 </template>
 
 <script>
 export default {
-  name: 'inverterstatusdata',
+  name: 'inverterinfo',
   data() {
     return {
-      startTime: new Date(new Date().toLocaleDateString()).getTime(),
-      endTime: new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000 - 1,
+      equipmentId: [],
+      equipmentOptions:[],
+      dateTime: [new Date(new Date().toLocaleDateString()).getTime(), new Date(new Date().toLocaleDateString()).getTime() + 60 * 60 * 24 * 1000-5*1000*60],
+      total: 0,
+      sortOrder: 'asc',
+      pageSize: 10,
+      currentPage: 1,
       stationList: [],
       stationCode: [],
-      loading: false,
-      inverterInfoList: [],
-      equipmentId: '',
       searchForm: {},
       tableData: [],
-      page: {
-        total: 0, // 总页数
-        currentPage: 1, // 当前页数
-        pageSize: 20 // 每页显示多少条
-      },
-      tableLoading: false,
-      tableOption: tableOption
+      nameList:[],
+      loading: false,
+      modId: '',//备用id
     }
   },
-  computed: {
-    ...mapGetters(['permissions']),
-    permissionList() {
-      return {
-        addBtn: this.vaildData(this.permissions.idp_inverterstatusdata_add, false),
-        delBtn: this.vaildData(this.permissions.idp_inverterstatusdata_del, false),
-        editBtn: this.vaildData(this.permissions.idp_inverterstatusdata_edit, false)
-      };
-    }
+  created(){
+    // 获取所有逆变器名称
+    this.$axios.get('/inverterinfo/findAll').then((res) => {
+      this.nameList = res.data
+    }).catch((error) => {
+      this.$message.error('获取逆变器转义名称出错' + error)
+    })
   },
-  created() {
-    this.getStationCode();
-    this.getAllInverterInfo()
+  mounted() {
+    this.getStationCode()
   },
+  computed: {},
   methods: {
-    getGridOnloadData() {
-      const param = new URLSearchParams()
-      param.append('currentPage', this.page.currentPage)
-      param.append('pageSize', this.page.pageSize)
-      param.append('stationCode', this.stationCode)
-      param.append("equipmentId", this.equipmentId)
-      param.append('startTime', this.startTime)
-      param.append('endTime', this.endTime)
-      getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
-        this.tableData = response.data.data.records
-        this.page.total = response.data.data.total
-        this.page.pageSize = response.data.data.size
-        this.tableLoading = false
-      }).catch(() => {
-        this.tableLoading = false
+    stationChange() {
+      this.currentPage = 1
+      this.pageSize = 10
+
+      const param = {
+        "stationCode": this.stationCode,
+      }
+      // 获取场站下风机设备
+      this.$axios.get('/inverterinfo/findByStationCode', {params: param}).then((res) => {
+        this.equipmentOptions = res.data
+      }).catch((error) => {
+        this.$message.error('获取逆变器设备出错' + error)
       })
     },
-    dateQuery() {
-      if (this.equipmentId === '' || this.equipmentId == null) {
-        return alert("请选择所属设备")
+    nameFormat({cellValue, row, column}) {
+      const item = this.nameList.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    stationCodeFormat({cellValue, row, column}) {
+      const item = this.stationList.find(item => item.value === cellValue)
+      return item ? item.label : ''
+    },
+    statusFormat({cellValue, row, column}) {
+      if (cellValue == 1) {
+        return '运行'
+      } else if (cellValue == 2) {
+        return '待机'
+      } else if (cellValue == 3) {
+        return '停用'
+      } else if (cellValue == 4) {
+        return '故障'
+      }
+    },
+    handlePageChange({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      this.pageSize = pageSize
+      this.dataQuery();
+    },
+    dataQuery() {
+      let startTime = Math.round(this.dateTime[0])
+      let endTime = Math.round(this.dateTime[1])
+      if (endTime <= startTime) {
+        this.$message.error("开始时间不能大于结束时间")
+        return
+      }
+
+      this.loading = true
+      let queryParams = {
+        "currentPage": this.currentPage,
+        "pageSize": this.pageSize,
+        "stationCode": this.stationCode,
+        "equipmentId": this.equipmentId.join(','),
+        "startTime": startTime,
+        "endTime": endTime,
       }
-      this.tableLoading = true
-      const param = new URLSearchParams()
-      param.append('currentPage', this.page.currentPage)
-      param.append('pageSize', this.page.pageSize)
-      param.append('stationCode', this.stationCode)
-      param.append("equipmentId", this.equipmentId)
-      param.append('startTime', this.startTime)
-      param.append('endTime', this.endTime)
 
-      getByStationCodeAndEquipmentIdAndTimeBetween(param).then(response => {
-        this.tableData = response.data.data.records
-        this.page.total = response.data.data.total
-        this.tableLoading = false
+      this.$axios.get('/inverterstatusdata/getByStationCodeAndEquipmentIdAndTimeBetween', {params: queryParams}).then(response => {
+        this.tableData = response.data.records
+        this.page.total = response.data.total
+        this.loading = false
       }).catch(() => {
-        this.tableLoading = false
+        this.loading = false
       })
     },
     getStationCode() {
-      this.tableLoading = true
-      getStation().then(response => {
-        this.stationList = response.data.data
+      this.$axios({url: '/electricfield/all', method: 'get'}).then(response => {
+        this.stationList = response.data
         if (this.stationList.length > 0) {
           this.stationCode = this.stationList[0].value
+          this.stationChange()
         }
-        this.tableLoading = false
       })
     },
-    getAllInverterInfo() {
-      this.inverterInfoList = []
-      this.equipmentId = ''
-      this.tableLoading = true
-      const param = new URLSearchParams()
-      param.append('stationCode', this.stationCode)
-      getAllInverterInfo(param).then(response => {
-        this.inverterInfoList = response.data.data
-        if (this.inverterInfoList.length > 0) {
-          this.equipmentId = this.inverterInfoList[0].value
-        }
-        this.tableLoading = false
-      })
-    },
-    sizeChange(pageSize) {
-      this.page.pageSize = pageSize
-    },
-    currentChange(current) {
-      this.page.currentPage = current
-    },
-    searchChange(form, done) {
-      this.searchForm = form
-      this.page.currentPage = 1
-      this.getList(this.page, form)
-      done()
-    },
-    refreshChange() {
-      this.getList(this.page)
-    }
   }
 }
 </script>

+ 0 - 3
cpp-ui/src/views/stationDataQuery/windturbinestatusdata/index.vue

@@ -105,7 +105,6 @@ export default {
     // 获取所有风机名称
     this.$axios.get('/windturbineinfo/findAll').then((res) => {
       this.nameList = res.data
-      console.log(this.nameList)
     }).catch((error) => {
       this.$message.error('获取风机转义名称出错' + error)
     })
@@ -170,8 +169,6 @@ export default {
         "startTime": startTime,
         "endTime": endTime,
       }
-console.log(queryParams)
-
       this.$axios.get('/windturbinestatusdata/getByStationCodeAndEquipmentIdAndTimeBetween', {params: queryParams}).then(response => {
         this.tableData = response.data.records
         this.page.total = response.data.total