Prechádzať zdrojové kódy

逆变器信息查询

xusl 7 mesiacov pred
rodič
commit
eb86c3c4d0

+ 211 - 0
cpp-admin/src/main/java/com/cpp/web/controller/configManager/ElectricFieldController.java

@@ -0,0 +1,211 @@
+package com.cpp.web.controller.configManager;
+
+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.ElectricField;
+import com.cpp.web.domain.station.enums.ProvinceEnum;
+import com.cpp.web.service.station.ElectricFieldService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import java.math.RoundingMode;
+import java.util.*;
+
+
+/**
+ * idp_electric_field
+ *
+ * @author whc
+ * @date 2022-03-18 15:48:48
+ */
+@RestController
+@Slf4j
+@RequiredArgsConstructor
+@RequestMapping("/electricfield")
+@Api(value = "electricfield", tags = "idp_electric_field管理")
+public class ElectricFieldController {
+
+    private final ElectricFieldService electricFieldService;
+
+    /**
+     * 分页查询
+     *
+     * @param page          分页对象
+     * @param electricField idp_electric_field
+     * @return
+     */
+    @ApiOperation(value = "分页查询", notes = "分页查询")
+    @GetMapping("/page")
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_get')")
+    public R getElectricFieldPage(Page page, ElectricField electricField) {
+        return R.ok(electricFieldService.page(page, Wrappers.query(electricField)));
+    }
+
+    /**
+     * 通过id查询idp_electric_field
+     *
+     * @param id id
+     * @return R
+     */
+    @ApiOperation(value = "通过id查询", notes = "通过id查询")
+    @GetMapping("/{id}")
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_get')")
+    public R getById(@PathVariable("id") String id) {
+        return R.ok(electricFieldService.getById(id));
+    }
+
+    @GetMapping("/all")
+    public R findAll() {
+        List<ElectricField> electricFieldList = electricFieldService.list();
+        List<Map<String, String>> list = new ArrayList<>();
+        for (ElectricField e : electricFieldList) {
+            Map<String, String> map = new HashMap<>();
+            map.put("label", e.getName());
+            map.put("value", e.getStationCode());
+            list.add(map);
+        }
+        return R.ok(list);
+    }
+
+    @GetMapping("/getElectricFieldTypeEnum")
+    public R getElectricFieldTypeEnum() {
+        List<Map<String, Object>> type = new ArrayList<>();
+        Map<String, Object> map;
+        try {
+            map = new HashMap<>();
+            map.put("label", "光伏电站");
+            map.put("value", "1");
+            type.add(map);
+            map = new HashMap<>();
+            map.put("label", "风力电站");
+            map.put("value", "2");
+            type.add(map);
+            return R.ok(type);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(type);
+        }
+
+    }
+
+    @GetMapping("/getProvinceEnum")
+    public R getProvinceEnum() {
+        List<Map<String, Object>> provinceType = new ArrayList<>();
+        Map<String, Object> map;
+        try {
+            for (ProvinceEnum e : ProvinceEnum.values()) {
+                map = new HashMap<>();
+                map.put("label", e.getMessage());
+                map.put("key", e.name());
+                map.put("value", e.name());
+                provinceType.add(map);
+            }
+            return R.ok(provinceType);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.fail(provinceType);
+        }
+
+    }
+
+    /**
+     * 新增idp_electric_field
+     *
+     * @param electricField idp_electric_field
+     * @return R
+     */
+    @ApiOperation(value = "新增idp_electric_field", notes = "新增idp_electric_field")
+    //    @SysLog("新增idp_electric_field")
+    @PostMapping
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_add')")
+    public R save(@RequestBody ElectricField electricField) {
+        return R.ok(electricFieldService.save(electricField));
+    }
+
+    /**
+     * 修改idp_electric_field
+     *
+     * @param electricField idp_electric_field
+     * @return R
+     */
+    @ApiOperation(value = "修改idp_electric_field", notes = "修改idp_electric_field")
+    //    @SysLog("修改idp_electric_field")
+    @PutMapping
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_edit')")
+    public R updateById(@RequestBody ElectricField electricField) {
+        return R.ok(electricFieldService.updateById(electricField));
+    }
+
+    /**
+     * 通过id删除idp_electric_field
+     *
+     * @param id id
+     * @return R
+     */
+    @ApiOperation(value = "通过id删除idp_electric_field", notes = "通过id删除idp_electric_field")
+    //    @SysLog("通过id删除idp_electric_field")
+    @DeleteMapping("/{id}")
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_del')")
+    public R removeById(@PathVariable String id) {
+        return R.ok(electricFieldService.removeById(id));
+    }
+
+
+    @ApiOperation(value = "通过条件查询装机容量", notes = "通过条件查询装机容量")
+    @PostMapping("/getByStationCode")
+    ////@PreAuthorize("@pms.hasPermission('idp_electricfield_get')")
+    public R getByStationCode(String stationCode) {
+        return R.ok(electricFieldService.findByStationCode(stationCode));
+    }
+
+    @ApiOperation(value = "同步数据", notes = "同步数据")
+    @GetMapping("/syncStation")
+    //@PreAuthorize("@pms.hasPermission('idp_windtowerstatusdata_get')")
+    public R syncStation() {
+        return R.ok(electricFieldService.saveBatch(electricFieldService.syncStation()));
+    }
+
+    @GetMapping("/homgpageAllWindTurbineInfo")
+    public R homgpageAllWindTurbineInfo() {
+        List<ElectricField> electricFieldList = electricFieldService.list();
+        List<Map<String, String>> list = new ArrayList<>();
+        for(ElectricField electricField:electricFieldList){
+            Map<String, String> map = new HashMap<>();
+            map.put("type","ElectricField");
+            map.put("name", electricField.getName());
+//            map.put("sign", electricField.getSign());
+            map.put("electricFieldTypeEnum", electricField.getElectricFieldTypeEnum().equals("1")?"光伏电站":"风力电站");
+            map.put("capacity", electricField.getCapacity().setScale(2, RoundingMode.HALF_UP).toString());
+            map.put("longitude", electricField.getLongitude().toString());
+            map.put("latitude", electricField.getLatitude().toString());
+            list.add(map);
+        }
+
+        return R.ok(list);
+    }
+
+    /**
+     * 获取首页限电标识状态
+     * @return 结果集
+     */
+    @GetMapping(value = "/getServerTime")
+    public R getServerTime(){
+        try{
+            Date d = new Date();
+            return R.ok(d);
+        }catch(Exception e){
+            log.error("系统时间获取失败",e);
+            return R.fail(e.toString());
+        }
+    }
+
+    @GetMapping("/allData")
+    public R allData() {
+        List<ElectricField> electricFieldList = electricFieldService.list();
+        return R.ok(electricFieldList);
+    }
+}

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

@@ -0,0 +1,142 @@
+package com.cpp.web.controller.configManager;
+
+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.InverterInfo;
+import com.cpp.web.service.station.InverterInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * idp_inverter_info
+ *
+ * @author whc
+ * @date 2022-03-18 15:49:11
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/inverterinfo")
+@Api(value = "inverterinfo", tags = "idp_inverter_info管理")
+public class InverterInfoController {
+
+    private final InverterInfoService inverterInfoService;
+
+    /**
+     * 分页查询
+     *
+     * @param page         分页对象
+     * @param inverterInfo idp_inverter_info
+     * @return
+     */
+    @ApiOperation(value = "分页查询", notes = "分页查询")
+    @GetMapping("/page")
+    public R getInverterInfoPage(Page page, InverterInfo inverterInfo) {
+        return R.ok(inverterInfoService.page(page, Wrappers.query(inverterInfo)));
+    }
+
+    /**
+     * 根据场站编号分页查询
+     *
+     * @param currentPage
+     * @param pageSize
+     * @param stationCode
+     * @return
+     */
+    @ApiOperation(value = "根据场站编号分页查询", notes = "分页查询")
+    @GetMapping("/getByStationCode")
+    public R getByStationCode(Long currentPage,Long pageSize,String stationCode) {
+        Page page = new Page(currentPage, pageSize);
+        page.setMaxLimit((long) -1);
+        return R.ok(inverterInfoService.page(page, inverterInfoService.getByStationCode(stationCode)));
+    }
+
+    /**
+     * 通过id查询idp_inverter_info
+     *
+     * @param id id
+     * @return R
+     */
+    @ApiOperation(value = "通过id查询", notes = "通过id查询")
+    @GetMapping("/{id}")
+    public R getById(@PathVariable("id") String id) {
+        return R.ok(inverterInfoService.getById(id));
+    }
+
+    /**
+     * 新增idp_inverter_info
+     *
+     * @param inverterInfo idp_inverter_info
+     * @return R
+     */
+    @ApiOperation(value = "新增idp_inverter_info", notes = "新增idp_inverter_info")
+    @PostMapping
+    public R save(@RequestBody InverterInfo inverterInfo) {
+        return R.ok(inverterInfoService.save(inverterInfo));
+    }
+
+    /**
+     * 修改idp_inverter_info
+     *
+     * @param inverterInfo idp_inverter_info
+     * @return R
+     */
+    @ApiOperation(value = "修改idp_inverter_info", notes = "修改idp_inverter_info")
+    @PutMapping
+    public R updateById(@RequestBody InverterInfo inverterInfo) {
+        return R.ok(inverterInfoService.updateById(inverterInfo));
+    }
+
+    /**
+     * 通过id删除idp_inverter_info
+     *
+     * @param id id
+     * @return R
+     */
+    @ApiOperation(value = "通过id删除idp_inverter_info", notes = "通过id删除idp_inverter_info")
+    @DeleteMapping("/{id}")
+    public R removeById(@PathVariable String id) {
+        return R.ok(inverterInfoService.removeById(id));
+    }
+
+    /**
+     * 根据场站编号查询 返回map格式
+     *
+     * @param stationCode
+     * @return
+     */
+    @ApiOperation(value = "根据场站编号查询", notes = "分页查询")
+    @PostMapping("/findByStationCode")
+    public R findByStationCode(String stationCode) {
+        List<InverterInfo> inverterInfoList = inverterInfoService.findByStationCode(stationCode);
+        List<Map<String, String>> list = new ArrayList<>();
+        for (InverterInfo e : inverterInfoList) {
+            Map<String, String> map = new HashMap<>();
+            map.put("label", e.getName());
+            map.put("value", e.getEquipmentNo());
+            list.add(map);
+        }
+        return R.ok(list);
+    }
+
+    @GetMapping("/all")
+    public R findAll() {
+        List<InverterInfo> inverterInfoList = inverterInfoService.list();
+        List<Map<String, String>> list = new ArrayList<>();
+        for (InverterInfo e : inverterInfoList) {
+            Map<String, String> map = new HashMap<>();
+            map.put("label", e.getName());
+            map.put("value", e.getId()+"");
+            list.add(map);
+        }
+        return R.ok(list);
+    }
+}

+ 1 - 1
cpp-admin/src/main/java/com/cpp/web/domain/station/ElectricField.java

@@ -105,5 +105,5 @@ public class ElectricField extends BaseCppEntity {
      */
 //    @Enumerated(EnumType.STRING)
     @ApiModelProperty(value = "省份")
-    private ProvinceEnum provinceEnum;
+    private String provinceEnum;
 }

+ 2 - 0
cpp-admin/src/main/java/com/cpp/web/domain/station/InverterInfo.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.cpp.common.core.domain.BaseEntity;
 import com.cpp.web.domain.BaseCppEntity;
 import com.cpp.web.domain.station.enums.EquipmentTypeEnum;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -64,6 +65,7 @@ public class InverterInfo extends BaseCppEntity {
      * 安装时间
      */
     @ApiModelProperty(value = "安装时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date installationTime;
 
 

+ 3 - 1
cpp-ui/package.json

@@ -58,7 +58,9 @@
     "vue-meta": "2.4.0",
     "vue-router": "3.4.9",
     "vuedraggable": "2.24.3",
-    "vuex": "3.6.0"
+    "vuex": "3.6.0",
+    "vxe-table": "^2.11.0",
+    "xe-utils": "^3.5.30"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",

+ 20 - 3
cpp-ui/src/main.js

@@ -12,13 +12,22 @@ import store from './store'
 import router from './router'
 import directive from './directive' // directive
 import plugins from './plugins' // plugins
-import { download } from '@/utils/request'
-
+import service, { download } from '@/utils/request'
+import request from '@/utils/request'
+import axios from 'axios'
 import './assets/icons' // icon
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
 import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+import {
+  parseTime,
+  resetForm,
+  addDateRange,
+  selectDictLabel,
+  selectDictLabels,
+  handleTree,
+  tansParams
+} from "@/utils/ruoyi";
 // 分页组件
 import Pagination from "@/components/Pagination";
 // 自定义表格工具组件
@@ -37,6 +46,13 @@ import DictTag from '@/components/DictTag'
 import VueMeta from 'vue-meta'
 // 字典数据组件
 import DictData from '@/components/DictData'
+import {getToken} from "@/utils/auth";
+import cache from "@/plugins/cache";
+Vue.prototype.$request = request
+
+import 'xe-utils'
+import VXETable from 'vxe-table'
+import 'vxe-table/lib/style.css'
 
 // 全局方法挂载
 Vue.prototype.getDicts = getDicts
@@ -58,6 +74,7 @@ Vue.component('FileUpload', FileUpload)
 Vue.component('ImageUpload', ImageUpload)
 Vue.component('ImagePreview', ImagePreview)
 
+Vue.use(VXETable)
 Vue.use(directive)
 Vue.use(plugins)
 Vue.use(VueMeta)

+ 134 - 0
cpp-ui/src/views/configManager/inverterinfo/index.vue

@@ -0,0 +1,134 @@
+<template>
+  <div class="app-container">
+    <el-form ref="queryForm" size="small" :inline="true">
+      <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>
+        <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"
+          border
+          export-config
+          keep-source
+          auto-resize
+          resizable
+          highlight-current-row
+          :loading="loading"
+          :data="tableData"
+          :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}">
+        <vxe-table-column field="equipmentNo" title="设备编号" ></vxe-table-column>
+        <vxe-table-column field="name" title="设备名称" ></vxe-table-column>
+        <vxe-table-column field="manufacturer" title="制造商" ></vxe-table-column>
+        <vxe-table-column field="modelNumber" title="型号" ></vxe-table-column>
+        <vxe-table-column field="installationTime" title="安装时间" ></vxe-table-column>
+        <vxe-table-column field="timeInterval" title="入库时间间隔" :formatter="timeIntervalFormat"></vxe-table-column>
+        <vxe-table-column field="groupSeries" title="是否组串式"  :formatter="yesNoFormat"></vxe-table-column>
+        <vxe-table-column field="efficiency" title="逆变器效率" ></vxe-table-column>
+        <vxe-table-column field="capacity" title="额定功率" ></vxe-table-column>
+        <vxe-table-column field="collectorCircuit" title="集电线路" ></vxe-table-column>
+        <vxe-table-column field="sample" title="逆变器是否样板机" :formatter="yesNoFormat"></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>
+
+  </div>
+</template>
+
+
+<script>
+export default {
+  name: 'inverterinfo',
+  data() {
+    return {
+      total: 0,
+      sortOrder: 'asc',
+      pageSize: 10,
+      currentPage: 1,
+      stationList: [],
+      stationCode: [],
+      searchForm: {},
+      tableData: [],
+      loading: false,
+      modId: '',//备用id
+    }
+  },
+  mounted() {
+    this.getStationCode()
+  },
+  computed: {},
+  methods: {
+    stationChange(){
+      this.currentPage = 1
+      this.pageSize = 10
+    },
+    timeIntervalFormat({ cellValue, row, column }) {
+      if (cellValue==1){
+        return '一分钟'
+      }
+      else if (cellValue==5){
+        return '五分钟'
+      }
+      return ''
+    },
+    yesNoFormat({ cellValue, row, column }) {
+      if (cellValue==0){
+        return '不是'
+      }
+      else {
+        return '是'
+      }
+    },
+    handlePageChange({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      this.pageSize = pageSize
+      this.dataQuery();
+    },
+    dataQuery() {
+      this.loading = true
+      const param = {
+        "currentPage":this.currentPage,
+        "pageSize":this.pageSize,
+        "stationCode":this.stationCode
+      }
+
+      this.$request.get('/inverterinfo/getByStationCode', {params: param}).then(response => {
+        this.tableData = response.data.records
+        this.page.total = response.data.total
+        this.loading = false
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+    getStationCode() {
+      this.$request({url: '/electricfield/all', method: 'get'}).then(response => {
+        this.stationList = response.data
+        if (this.stationList.length>0){
+          this.stationCode = this.stationList[0].value
+          this.dataQuery()
+        }
+      })
+    },
+  }
+}
+</script>