wanghc vor 3 Jahren
Ursprung
Commit
d4372fd2c1

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

@@ -38,7 +38,7 @@ public class AbstractEquipmentStatusData implements Serializable {
 
     /**
      * 状态
-     * 状态值为0代表运行,1代表故障,2代表待机,3代表检修
+     * 状态值为1代表运行,2代表待机,3代表停用,4代表故障
      */
     @Column
     private Integer status = 0;

+ 6 - 58
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/InverterInfo.java

@@ -22,96 +22,44 @@ import java.math.BigDecimal;
 @Entity
 public class InverterInfo extends AbstractEquipmentInfo {
 
-    public InverterInfo() {
-        super.setEquipmentType(EquipmentTypeEnum.INVERTER);
-    }
-    /**
-     * 备用字段A 应用于样板机编号
-     */
     /**
      * 逆变器名称
      */
     @Column
     private String name;
-
+    /**
+     * 备用字段A 应用于样板机编号
+     */
     /**
      * 是否组串式
      */
     @Column
     private Boolean groupSeries;
-
     /**
      * 逆变器效率(%)
      */
     @Digits(integer = 5, fraction = 2)
     @Column
     private BigDecimal efficiency;
-
     /**
      * 额定功率(KW)
      */
     @Digits(integer = 10, fraction = 2)
     @Column
     private BigDecimal capacity;
-
-    /**
-     * 箱式变压器
-     */
-    @Column
-    private String box;
-
     /**
      * 集电线路
      */
     @Column
     private String collectorCircuit;
-
-
-    /**
-     * 光伏组件型号
-     */
-    @Column
-    private String batteryModel;
-
-    /**
-     * 光伏组件数量(个)
-     */
-    @Column
-    private Integer batteryNumber;
-
-    /*   *//**
-     * 光伏阵列的倾斜角(°)
-     *//*
-    @Column
-    private Float pvArrayAngle;
-
-    *//**
-     * 光伏阵列的方位(°),方位角为零。正南为0,正西为90,正北180,正东270
-     *//*
-    @Column
-    private Float pvPosition;
-
-    *//**
-     * 光伏组件旋转方式
-     *//*
-    @Column
-    private PvRotationModeEnum pvRotationModeEnum;
-*/
     /**
      * 逆变器是否样板机
      */
     @Column
     private Boolean sample;
 
-    /**
-     * backupA 样板机编号
-     */
-
-    /**
-     * backupB 经度
-     */
+    public InverterInfo() {
+        super.setEquipmentType(EquipmentTypeEnum.INVERTER);
+    }
 
-    /**
-     * backupC 纬度
-     */
 }

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

@@ -1,5 +1,6 @@
 package com.jiayue.ipfcst.common.data.repository;
 
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.DataPoint;
 
 import java.util.List;
@@ -12,5 +13,5 @@ import java.util.List;
  * @since 2019/8/5 9:15
  */
 public interface DataPointRepository extends BaseRepository<DataPoint, Integer> {
-    List<DataPoint> findAllByEquipmentType(Integer equipmentType);
+    List<DataPoint> findAllByEquipmentType(EquipmentTypeEnum equipmentType);
 }

+ 407 - 459
ipfcst-console/src/main/frontend/views/console/inverterInfo/index.vue

@@ -12,7 +12,7 @@
           </el-button>
         </div>
         <span style="font-weight: bold;font-size: 14px">场站名称:</span>
-        <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+        <el-select v-model="stationCode" clearable size="small" style="width:250px">
           <el-option
             v-for="item in stationList"
             :key="item.stationCode"
@@ -22,123 +22,93 @@
             <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
           </el-option>
         </el-select>
-        <el-button type="primary" icon="el-icon-search" size="small" @click="getData">查询</el-button>
-        <el-button type="primary" @click="insertEvent" size="small" style="round-clip: 10px" :loading="loadButton">添加</el-button>
+        <el-button icon="el-icon-search" size="small" type="primary" @click="getData">查询</el-button>
+        <el-button :loading="loadButton" size="small" style="round-clip: 10px" type="primary" @click="insertEvent">添加
+        </el-button>
         <el-button
-          size="small"
           :loading="loadButton"
-          type="primary"
+          size="small"
           style="round-clip: 10px"
+          type="primary"
           @click="piInsertEvent">
           批量添加
         </el-button>
         <el-button
-          size="small"
           :loading="loadButton"
-          type="danger"
+          size="small"
           style="round-clip: 10px"
+          type="danger"
           @click="getSelectionEvent">
           批量删除
         </el-button>
         <div style="padding-top: 10px">
           <vxe-table
+            v-show="showTable"
             ref="xTable"
+            :data="tableData"
+            :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}"
+            :edit-rules="rules"
+            :loading="loading"
+            auto-resize
             border
             export-config
-            keep-source
-            auto-resize
-            resizable
             highlight-current-row
-            :loading="loading"
-            :edit-rules="rules"
-            :data="tableData"
-            v-show="showTable"
-            :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}">
-            <vxe-table-column title="逆变器信息" align="center">
+            keep-source
+            resizable>
+            <vxe-table-column align="center" title="逆变器信息">
               <vxe-table-column type="checkbox" width="3%"></vxe-table-column>
-              <vxe-table-column field="stationCode" title="场站编号" width="6%"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="equipmentNo" width="10%" title="设备编号"
-                                :edit-render="{name:'$input',attrs:{type:'text'}}"></vxe-table-column>
-              <vxe-table-column field="name" title="名称" width="8%" align="center"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="modelNumber" title="型号" width="8%" align="center"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="manufacturer" title="生产商" width="8%" align="center"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column width="150px" field="installationTime" title="安装时间" align="center"
-                                :edit-render="{props: {type: 'default'}}">
-                <template v-slot:edit="{ row }">
-                  <el-date-picker
-                    size="mini"
-                    v-model="row.installationTime"
-                    style="width: 100%"
-                    type="date"
-                    placeholder="选择日期:"
-                  />
-                </template>
-                <template v-slot="{ row }">{{ timestampToTime(row.installationTime) }}</template>
-              </vxe-table-column>
-              <vxe-table-column field="report" title="是否上报" width="8%" align="center"
-                                :edit-render="{name: '$select', options: trueOrFalse}"></vxe-table-column>
-              <vxe-table-column field="capacity" title="额定功率" width="8%" align="center"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="efficiency" title="效率" width="8%" align="center"
-                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="box" title="箱式变压器" width="8%" align="center"
-                                :edit-render="{name: '$input', props: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="collectorCircuit" title="集电线路" width="8%" align="center"
-                                :edit-render="{name: '$input', props: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="batteryModel" title="光组型号" width="8%" align="center"
-                                :edit-render="{name: '$select', options: pvInfoMode}"></vxe-table-column>
-              <vxe-table-column field="batteryNumber" title="光组个数" width="8%" align="center"
-                                :edit-render="{name: '$input', props: {type: 'number'}}"></vxe-table-column>
-              <vxe-table-column field="groupSeries" title="是否组串" width="6%" align="center"
-                                :edit-render="{name: '$select', options: trueOrFalse}"></vxe-table-column>
-              <vxe-table-column field="sample" title="是否样板" width="6%" align="center"
-                                :edit-render="{name: '$select', options: trueOrFalse}"></vxe-table-column>
-              <vxe-table-column field="backupA" width="10%" title="样板机编号"
-                :edit-render="{name: '$input',attrs:{type:'text'}}"/>
-              <vxe-table-column field="backupB" title="经度" width="8%" align="center"
-                                :edit-render="{name: '$input', props: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="backupC" title="纬度" width="8%" align="center"
-                                :edit-render="{name: '$input', props: {type: 'text'}}"></vxe-table-column>
-              <vxe-table-column field="interval" title="入库间隔(单位s)" width="8%" align="center"
-                                :edit-render="{name: '$select', options: intervals}"></vxe-table-column>
-              <vxe-table-column title="操作" fixed="right" width="10%" align="center">
+              <vxe-table-column :edit-render="{name: '$input', attrs: {type: 'text'}}" field="stationCode" title="场站编号"
+                                width="6%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name:'$input',attrs:{type:'text'}}" field="equipmentNo" title="设备编号"
+                                width="10%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$input', attrs: {type: 'text'}}" align="center" field="name" title="名称"
+                                width="8%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$select', options: trueOrFalse}" align="center" field="report" title="是否上报"
+                                width="8%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$input', attrs: {type: 'text'}}" align="center" field="capacity" title="额定功率"
+                                width="8%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$input', attrs: {type: 'text'}}" align="center" field="efficiency" title="效率"
+                                width="8%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$input', props: {type: 'text'}}" align="center" field="collectorCircuit" title="集电线路"
+                                width="8%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$select', options: trueOrFalse}" align="center" field="groupSeries" title="是否组串"
+                                width="6%"></vxe-table-column>
+              <vxe-table-column :edit-render="{name: '$select', options: trueOrFalse}" align="center" field="sample" title="是否样板"
+                                width="6%"></vxe-table-column>
+              <vxe-table-column align="center" fixed="right" title="操作" width="10%">
                 <template v-slot="{ row }">
                   <template v-if="$refs.xTable.isActiveByRow(row)">
                     <el-button
-                      type="success"
-                      style="padding: 3px 4px 3px 4px;margin: 2px;"
-                      size="medium"
                       icon="el-icon-edit"
+                      size="medium"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      type="success"
                       @click="editSave(row)">保存
                     </el-button>
                     <el-button
                       class="cancel-btn"
                       icon="el-icon-refresh"
-                      type="warning"
-                      style="padding: 3px 4px 3px 4px;margin: 2px;"
                       size="medium"
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      type="warning"
                       @click="cancelRowEvent(row)">取消
                     </el-button>
                   </template>
                   <template v-else>
                     <el-button
                       :loading="loadButton"
-                      type="primary"
-                      style="padding: 3px 4px 3px 4px;margin: 2px;"
-                      size="medium "
                       icon="el-icon-edit"
+                      size="medium "
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      type="primary"
                       @click="editRowEvent(row)">编辑
                     </el-button>
                     <el-button
                       :loading="loadButton"
-                      type="danger"
-                      style="padding: 3px 4px 3px 4px;margin: 2px;"
-                      size="medium "
                       icon="el-icon-delete"
+                      size="medium "
+                      style="padding: 3px 4px 3px 4px;margin: 2px;"
+                      type="danger"
                       @click="deleteRowEvent(row)">删除
                     </el-button>
                   </template>
@@ -148,21 +118,21 @@
             </vxe-table-column>
           </vxe-table>
           <vxe-pager
-            perfect
+            v-show="!loadButton&&showTable"
             :current-page.sync="currentPage"
+            :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
             :page-size.sync="pageSize"
-            :total="total"
             :page-sizes=[10,50,100]
-            :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
+            :total="total"
+            perfect
             @page-change="handlePageChange"
-            v-show="!loadButton&&showTable"
           >
           </vxe-pager>
         </div>
       </el-card>
     </div>
     <!-- 删除提示框 -->
-    <el-dialog :visible.sync="delVisible" title="提示" width="300px" center>
+    <el-dialog :visible.sync="delVisible" center title="提示" width="300px">
       <div class="del-dialog-cnt">删除不可恢复,是否确定删除?</div>
       <span slot="footer" class="dialog-footer">
                 <el-button type="primary" @click="deleteCancel()">取 消</el-button>
@@ -173,420 +143,398 @@
 </template>
 
 <script>
-  import request from '@/utils/request'
 
-  export default {
-    data() {
-      const checkName = (rule, value, callback) => {
-        var s6 = this.tableData
-        if (value == null || value === '') {
-          callback(new Error('请填写逆变器名称'))
-        }
-        for (let i = 0; i < s6.length; i++) {
-          if (this.id == '' || this.id == undefined) {
-            // 新增
+export default {
+  data() {
+    const checkName = (rule, value, callback) => {
+      var s6 = this.tableData
+      if (value == null || value === '') {
+        callback(new Error('请填写逆变器名称'))
+      }
+      for (let i = 0; i < s6.length; i++) {
+        if (this.id == '' || this.id == undefined) {
+          // 新增
+          if ((value == s6[i].name)) {
+            callback(new Error('名称不能重复'))
+          }
+        } else {
+          // 修改
+          if (this.id != s6[i].id) {
             if ((value == s6[i].name)) {
               callback(new Error('名称不能重复'))
             }
-          } else {
-            // 修改
-            if (this.id != s6[i].id) {
-              if ((value == s6[i].name)) {
-                callback(new Error('名称不能重复'))
-              }
-            }
           }
         }
-        callback()
       }
-      return {
-        stationCode: '',
-        stationList: [],
-        id:'',
-        currentPage: 1,
-        pageSize: 10,
-        total: 0,
-        isSample: '',
-        piadd: '',
-        loadButton: false,
-        loading: false,
-        rowId: "",
-        options: [{value: true, label: '样板机'},
-          {value: null, label: '所有'}],
-        option: "",
-        tableData: [],
-        showTable: true,
-        batchAddData: [],
-        delVisible: false,
-        //是否为编辑
-        isEdit: false,
-        pvInfo: [],
-        pvInfoMode: [],
-        pvRotationMode: [],
-        trueOrFalse: [{label: '是', value: true},
-          {label: '否', value: false}],
-        intervals:[{ key: 0, value: 0, label: '不入库' },{key:60,value:60,label:'一分钟'},{key:900,value:900,label:'十五分钟'}],
-        // 表单验证规则
-        rules: {
-          name: [
-            {required: true,  validator:checkName}
-          ],
-          modelNumber: [
-            {required: true, message: '逆变器型号不能为空', trigger: 'blur'}
-          ],
-          capacity: [
-            {required: true, message: '额定容量不能为空', trigger: 'blur'},
-            {pattern: /^\d+(\.\d{1,2})?$/, message: '只能输入正数数字或带小数点2位以内的数字'},
-          ],
-          efficiency: [
-            {required: true, message: '逆变器效率不能为空', trigger: 'blur'},
-            {pattern: /^\d+(\.\d{1,2})?$/, message: '只能输入正数数字或带小数点2位以内的数字'},
-          ],
-          backupB: [
-            { required: true, message: '请正确填写经度' },
-            {pattern: /^\d+(\.\d{1,4})?$/, message: '只能输入正数数字或带小数点4位以内的数字'}
-            // {message: '输入过长', max: 10}
-          ],
-          backupC: [
-            { required: true, message: '请正确填写纬度' },
-            {pattern: /^\d+(\.\d{1,4})?$/, message: '只能输入正数数字或带小数点4位以内的数字'}
-            // {message: '输入过长', max: 10}
-          ],
-          box: [
-            {required: true, message: '箱变不能为空', trigger: 'blur'},
-          ],
-          collectorCircuit: [
-            {required: true, message: '集电线不能为空', trigger: 'blur'},
-          ],
-          batteryModel: [
-            {required: true, message: '光组型号不能为空', trigger: 'blur'},
-          ],
-          batteryNumber: [
-            {required: true, message: '光组个数不能为空', trigger: 'blur'}
-          ],
-          groupSeries: [
-            {required: true, message: '是否组串式逆变器不能为空', trigger: 'change'}
-          ],
-          sample: [
-            {required: true, message: '是否样板机不能为空', trigger: 'change'}
-          ],
-          manufacturer: [
-            {required: true, message: '制造商名称不能为空'},
-          ],
-          installationTime: [
-            {required: true, message: '请选择日期'}
-          ],
-          report: [
-            {required: true, message: '是否上报不能为空', trigger: 'change'}
-          ]
-        }
+      callback()
+    }
+    return {
+      stationCode: '',
+      stationList: [],
+      id: '',
+      currentPage: 1,
+      pageSize: 10,
+      total: 0,
+      isSample: '',
+      piadd: '',
+      loadButton: false,
+      loading: false,
+      rowId: "",
+      options: [{value: true, label: '样板机'},
+        {value: null, label: '所有'}],
+      option: "",
+      tableData: [],
+      showTable: true,
+      batchAddData: [],
+      delVisible: false,
+      //是否为编辑
+      isEdit: false,
+      pvInfo: [],
+      pvInfoMode: [],
+      pvRotationMode: [],
+      trueOrFalse: [{label: '是', value: true},
+        {label: '否', value: false}],
+      intervals: [{key: 0, value: 0, label: '不入库'}, {key: 60, value: 60, label: '一分钟'}, {
+        key: 900,
+        value: 900,
+        label: '十五分钟'
+      }],
+      // 表单验证规则
+      rules: {
+        name: [
+          {required: true, validator: checkName}
+        ],
+        modelNumber: [
+          {required: true, message: '逆变器型号不能为空', trigger: 'blur'}
+        ],
+        capacity: [
+          {required: true, message: '额定容量不能为空', trigger: 'blur'},
+          {pattern: /^\d+(\.\d{1,2})?$/, message: '只能输入正数数字或带小数点2位以内的数字'},
+        ],
+        efficiency: [
+          {required: true, message: '逆变器效率不能为空', trigger: 'blur'},
+          {pattern: /^\d+(\.\d{1,2})?$/, message: '只能输入正数数字或带小数点2位以内的数字'},
+        ],
+        collectorCircuit: [
+          {required: true, message: '集电线不能为空', trigger: 'blur'},
+        ],
+        groupSeries: [
+          {required: true, message: '是否组串式逆变器不能为空', trigger: 'change'}
+        ],
+        sample: [
+          {required: true, message: '是否样板机不能为空', trigger: 'change'}
+        ],
+        report: [
+          {required: true, message: '是否上报不能为空', trigger: 'change'}
+        ]
       }
-    },
+    }
+  },
 
-    created() {
-      this.getStationList()
-      this.getData()
+  created() {
+    this.getStationList()
+    this.getData()
+  },
+  activated() {
+    console.log("2激活activated钩子函数");
+  },
+  deactivated() {
+    console.log("2激活deactivated钩子函数");
+  },
+  methods: {
+    getStationList() {
+      this.$axios.get('/electricField/getElectricField').then((res) => {
+        this.stationList = res.data
+      }).catch((error) => {
+        this.$message.error('获取场站下拉框出错' + error)
+      })
     },
-    activated() {
-      console.log("2激活activated钩子函数");
+    getData() {
+      this.loading = true
+      let queryParam = this.stationCode;
+      if (queryParam == '') {
+        queryParam = "ALL"
+      }
+      let url = this.currentPage + '/' + this.pageSize + '/' + queryParam
+      this.$axios.get('/inverterInfo/' + url).then(res => {
+        this.tableData = res.data.content
+        this.total = res.data.totalElements
+        this.loading = false
+        // console.log(res.data)
+        this.getPvData()
+      }).catch((error) => {
+        this.$message.error('获取逆变器信息出错' + error)
+      })
     },
-    deactivated() {
-      console.log("2激活deactivated钩子函数");
+    handlePageChange({currentPage, pageSize}) {
+      this.currentPage = currentPage
+      this.pageSize = pageSize
+      this.getData()
     },
-    methods: {
-      getStationList() {
-        this.$axios.get('/electricField/getElectricField').then((res) => {
-          this.stationList = res.data
-        }).catch((error) => {
-          this.$message.error('获取场站下拉框出错' + error)
-        })
-      },
-      getData() {
-        this.loading = true
-        let queryParam = this.stationCode;
-        if (queryParam==''){
-          queryParam="ALL"
-        }
-        let url = this.currentPage + '/' + this.pageSize + '/' + queryParam
-        this.$axios.get('/inverterInfo/' + url).then(res => {
-          this.tableData = res.data.content
-          this.total = res.data.totalElements
-          this.loading = false
-          // console.log(res.data)
-          this.getPvData()
-        }).catch((error) => {
-          this.$message.error('获取逆变器信息出错' + error)
-        })
-      },
-      handlePageChange({currentPage, pageSize}) {
-        this.currentPage = currentPage
-        this.pageSize = pageSize
-        this.getData()
-      },
-      getPvData() {
-        this.$axios.get('/pvModuleModel/').then(res => {
-          this.pvInfo = res.data
-          this.pvInfoMode = []
-          for (let i = 0; i < this.pvInfo.length; i++) {
-            const pInfo = {label: this.pvInfo[i].model, value: this.pvInfo[i].id}
-            this.pvInfoMode.push(pInfo)
-          }
-          console.log("获取所有光伏组件信息成功")
-        }).catch((error) => {
-          this.$message.error('获取逆变器信息出错' + error)
-        })
-      },
-      timestampToTime(time) {
-        const date = new Date(time) // 时间戳为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()
-        return Y + M + D
-      },
-      getSelectionEvent() {
-        let selectRecords = this.$refs.xTable.getCheckboxRecords()
-        if(selectRecords==""){
-          this.$message.error('请选择要删除的对象')
-          return
+    getPvData() {
+      this.$axios.get('/pvModuleModel/').then(res => {
+        this.pvInfo = res.data
+        this.pvInfoMode = []
+        for (let i = 0; i < this.pvInfo.length; i++) {
+          const pInfo = {label: this.pvInfo[i].model, value: this.pvInfo[i].id}
+          this.pvInfoMode.push(pInfo)
         }
-        this.rowId = ''
-        for (let i = 0; i < selectRecords.length; i++)
-          this.rowId += (selectRecords[i].id + ",")
-        // console.log(this.rowId)
-        this.delVisible = true
-      },
-      piInsertEvent(row) {
-        this.piadd = true;
-        this.showTable = true
-        this.isEdit = false;
-        this.loadButton = true;
-        this.$refs.xTable.insert({interval: 60}).then(({row}) => this.$refs.xTable.setActiveRow(row))
-      },
-      insertEvent(row) {
-        this.id = ''
-        this.showTable = true
-        this.piadd = false;
-        this.isEdit = false;
-        this.loadButton = true;
-        this.$refs.xTable.insert({interval: 60}).then(({row}) => this.$refs.xTable.setActiveRow(row))
-      },
-      async insertBatchEvent(row) {
-        /*const { row: newRow } = await this.$refs.bTable.insert()*/
-        // alert(1111)
-        // 插入一条数据并触发校验
-        let {row: newRow} = await this.$refs.bTable.insertAt(row)
-        await this.$refs.bTable.setActiveRow(newRow)
-        // alert(2222)
-        /*          const errMap = await this.$refs.bTable.validate(newRow).catch(errMap => errMap)
-                  if (errMap) {
+        console.log("获取所有光伏组件信息成功")
+      }).catch((error) => {
+        this.$message.error('获取逆变器信息出错' + error)
+      })
+    },
+    timestampToTime(time) {
+      const date = new Date(time) // 时间戳为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()
+      return Y + M + D
+    },
+    getSelectionEvent() {
+      let selectRecords = this.$refs.xTable.getCheckboxRecords()
+      if (selectRecords == "") {
+        this.$message.error('请选择要删除的对象')
+        return
+      }
+      this.rowId = ''
+      for (let i = 0; i < selectRecords.length; i++)
+        this.rowId += (selectRecords[i].id + ",")
+      // console.log(this.rowId)
+      this.delVisible = true
+    },
+    piInsertEvent(row) {
+      this.piadd = true;
+      this.showTable = true
+      this.isEdit = false;
+      this.loadButton = true;
+      this.$refs.xTable.insert({interval: 60}).then(({row}) => this.$refs.xTable.setActiveRow(row))
+    },
+    insertEvent(row) {
+      this.id = ''
+      this.showTable = true
+      this.piadd = false;
+      this.isEdit = false;
+      this.loadButton = true;
+      this.$refs.xTable.insert({interval: 60}).then(({row}) => this.$refs.xTable.setActiveRow(row))
+    },
+    async insertBatchEvent(row) {
+      /*const { row: newRow } = await this.$refs.bTable.insert()*/
+      // alert(1111)
+      // 插入一条数据并触发校验
+      let {row: newRow} = await this.$refs.bTable.insertAt(row)
+      await this.$refs.bTable.setActiveRow(newRow)
+      // alert(2222)
+      /*          const errMap = await this.$refs.bTable.validate(newRow).catch(errMap => errMap)
+                if (errMap) {
 
-                  }*/
-      },
-      async fullValidEvent() {
-        const errMap = await this.$refs.bTable.fullValidate().catch(errMap => errMap)
-        if (errMap) {
-          let msgList = []
-          Object.values(errMap).forEach(errList => {
-            errList.forEach(params => {
-              let {rowIndex, column, rules} = params
-              rules.forEach(rule => {
-                msgList.push(`第 ${rowIndex} 行 ${column.title} 校验错误:${rule.message}`)
-              })
+                }*/
+    },
+    async fullValidEvent() {
+      const errMap = await this.$refs.bTable.fullValidate().catch(errMap => errMap)
+      if (errMap) {
+        let msgList = []
+        Object.values(errMap).forEach(errList => {
+          errList.forEach(params => {
+            let {rowIndex, column, rules} = params
+            rules.forEach(rule => {
+              msgList.push(`第 ${rowIndex} 行 ${column.title} 校验错误:${rule.message}`)
             })
           })
-          this.$XModal.message({
-            status: 'error',
-            message: () => {
-              return [
-                < div
-            class
-              = "red"
-              style = "max-height: 400px;overflow: auto;" >
+        })
+        this.$XModal.message({
+          status: 'error',
+          message: () => {
+            return [
+              < div
+                class
+                  ="red"
+                style="max-height: 400px;overflow: auto;">
                 {
-                  msgList.map(msg => < div > {msg} < /div>)
+                  msgList.map(msg => < div> {msg} < /div>)
                 }
-                < /div>
+              < /div>
             ]
-            }
-          })
-        } else {
-          this.$XModal.message({status: 'success', message: '校验成功!'})
-        }
-      },
-      saveBatchEvent() {
-        const {insertRecords, removeRecords, updateRecords} = this.$refs.bTable.getRecordset()
-        this.$XModal.alert(`insertRecords=${insertRecords.length} removeRecords=${removeRecords.length} updateRecords=${updateRecords.length}`)
-      },
-      editRowEvent(row) {
-        this.id = row.id
-        for (let i = 0; i < this.pvInfoMode.length; i++) {
-          if (row.batteryModel == this.pvInfoMode[i].value) {
-            row.batteryModel = this.pvInfoMode[i].value
           }
+        })
+      } else {
+        this.$XModal.message({status: 'success', message: '校验成功!'})
+      }
+    },
+    saveBatchEvent() {
+      const {insertRecords, removeRecords, updateRecords} = this.$refs.bTable.getRecordset()
+      this.$XModal.alert(`insertRecords=${insertRecords.length} removeRecords=${removeRecords.length} updateRecords=${updateRecords.length}`)
+    },
+    editRowEvent(row) {
+      this.id = row.id
+      for (let i = 0; i < this.pvInfoMode.length; i++) {
+        if (row.batteryModel == this.pvInfoMode[i].value) {
+          row.batteryModel = this.pvInfoMode[i].value
         }
-        this.isEdit = true
-        this.loadButton = true
-        this.$refs.xTable.setActiveRow(row)
-      },
-      //设计有判断是否批量添加,批量添加弹窗表明添加条数,然后批量生成保存
-      editSave(row) {
-        this.$refs.xTable.validate(this.$refs.xTable.getCurrentRecord(),valid => {
+      }
+      this.isEdit = true
+      this.loadButton = true
+      this.$refs.xTable.setActiveRow(row)
+    },
+    //设计有判断是否批量添加,批量添加弹窗表明添加条数,然后批量生成保存
+    editSave(row) {
+      this.$refs.xTable.validate(this.$refs.xTable.getCurrentRecord(), valid => {
 
-          if (valid) {
-            if (this.piadd) {
-              const inviter = row
-              this.$prompt('请输入开始编号(例:1-0,其中0为开始值)', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                inputType: 'number',
-              }).then(({value}) => {
-                const startValue = value
-                if (startValue >= 0 && startValue != null) {
-                  this.$prompt('请输入添加数目', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    inputType: 'number',
-                  }).then(({value}) => {
-                    const endValue = value
-                    if (endValue >= 0) {
-                      this.$axios.post('/inverterInfo/saveAll/' + startValue + '/' + endValue, row).then(res => {
-                        this.$message({
-                          message: '保存成功',
-                          type: 'success'
-                        })
-                        this.loadButton = false
-                        this.piadd = false
-                        this.getData()
-                      }).catch((error) => {
-                        this.$refs.xTable.setActiveRow(row)
-                        this.$message.error('保存逆变器出错' + error)
+        if (valid) {
+          if (this.piadd) {
+            const inviter = row
+            this.$prompt('请输入开始编号(例:1-0,其中0为开始值)', '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              inputType: 'number',
+            }).then(({value}) => {
+              const startValue = value
+              if (startValue >= 0 && startValue != null) {
+                this.$prompt('请输入添加数目', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  inputType: 'number',
+                }).then(({value}) => {
+                  const endValue = value
+                  if (endValue >= 0) {
+                    this.$axios.post('/inverterInfo/saveAll/' + startValue + '/' + endValue, row).then(res => {
+                      this.$message({
+                        message: '保存成功',
+                        type: 'success'
                       })
-                    } else {
-                      alert("数量必须是正整数")
-                    }
-                  })
-                } else {
-                  alert("开始值必须是正整数并且不能为空")
-                }
-              })
-            } else {
-              this.$refs.xTable.clearActived().then(() => {
-                if (this.isEdit) {
-                  row.equipmentType = row.equipmentType.code
-                  //编辑保存
-                  this.$axios.put('/inverterInfo/', row).then(res => {
-                    this.$message({
-                      message: '修改成功',
-                      type: 'success'
+                      this.loadButton = false
+                      this.piadd = false
+                      this.getData()
+                    }).catch((error) => {
+                      this.$refs.xTable.setActiveRow(row)
+                      this.$message.error('保存逆变器出错' + error)
                     })
-                    this.loadButton = false;
-                    this.getData()
-                  }).catch((error) => {
-                    this.$refs.xTable.setActiveRow(row)
-                    this.$message.error('修改逆变器出错' + error)
+                  } else {
+                    alert("数量必须是正整数")
+                  }
+                })
+              } else {
+                alert("开始值必须是正整数并且不能为空")
+              }
+            })
+          } else {
+            this.$refs.xTable.clearActived().then(() => {
+              if (this.isEdit) {
+                row.equipmentType = row.equipmentType.code
+                //编辑保存
+                this.$axios.put('/inverterInfo/', row).then(res => {
+                  this.$message({
+                    message: '修改成功',
+                    type: 'success'
                   })
-                } else {
-                  //新增保存
-                  this.$axios.post('/inverterInfo/', row).then(res => {
-                    this.$message({
-                      message: '保存成功',
-                      type: 'success'
-                    })
-                    this.loadButton = false;
-                    this.getData()
-                  }).catch((error) => {
-                    this.$refs.xTable.setActiveRow(row)
-                    this.$message.error('保存逆变器出错' + error)
+                  this.loadButton = false;
+                  this.getData()
+                }).catch((error) => {
+                  this.$refs.xTable.setActiveRow(row)
+                  this.$message.error('修改逆变器出错' + error)
+                })
+              } else {
+                //新增保存
+                this.$axios.post('/inverterInfo/', row).then(res => {
+                  this.$message({
+                    message: '保存成功',
+                    type: 'success'
                   })
-                }
-              })
-            }
-          } else {
-            this.$XModal.message({status: 'error', message: '校验不通过!'})
-          }
-        })
-      },
-      cancelRowEvent(row) {
-        const xTable = this.$refs.xTable
-        xTable.clearActived().then(() => {
-          // 还原行数据
-          if (this.isEdit) {
-            //编辑
-            xTable.revertData(row)
-          } else {
-            //新增
-            xTable.remove(row)
+                  this.loadButton = false;
+                  this.getData()
+                }).catch((error) => {
+                  this.$refs.xTable.setActiveRow(row)
+                  this.$message.error('保存逆变器出错' + error)
+                })
+              }
+            })
           }
-          this.loadButton = false;
+        } else {
+          this.$XModal.message({status: 'error', message: '校验不通过!'})
+        }
+      })
+    },
+    cancelRowEvent(row) {
+      const xTable = this.$refs.xTable
+      xTable.clearActived().then(() => {
+        // 还原行数据
+        if (this.isEdit) {
+          //编辑
+          xTable.revertData(row)
+        } else {
+          //新增
+          xTable.remove(row)
+        }
+        this.loadButton = false;
+      })
+    },
+    // 删除场站信息
+    deleteRowEvent(row) {
+      this.rowId = row.id
+      this.delVisible = true
+    },
+    deleteCancel() {
+      this.delVisible = false
+    },
+    deleteInfo() {
+      this.$axios.delete('/inverterInfo/' + '' + this.rowId).then(res => {
+        this.$message({
+          message: '删除成功',
+          type: 'success'
         })
-      },
-      // 删除场站信息
-      deleteRowEvent(row) {
-        this.rowId = row.id
-        this.delVisible = true
-      },
-      deleteCancel() {
         this.delVisible = false
-      },
-      deleteInfo() {
-        this.$axios.delete('/inverterInfo/' + '' + this.rowId).then(res => {
-          this.$message({
-            message: '删除成功',
-            type: 'success'
-          })
-          this.delVisible = false
-          this.getData()
-        }).catch((error) => {
-          this.$message.error('删除逆变器信息出错' + error)
-        })
-      },
-      exportDataEvent() {
-        // this.loading = true
-        this.$axios.get('/inverterInfo/').then(res => {
-          const data = res.data.content
-          this.$refs.xTable.exportData({
-            filename: '逆变器信息',
-            type: 'csv',
-            isHeader: true,
-            isFooter: true,
-            data
-          })
-          // this.loading = false
-        }).catch(e => {
-          // this.loading = false
+        this.getData()
+      }).catch((error) => {
+        this.$message.error('删除逆变器信息出错' + error)
+      })
+    },
+    exportDataEvent() {
+      // this.loading = true
+      this.$axios.get('/inverterInfo/').then(res => {
+        const data = res.data.content
+        this.$refs.xTable.exportData({
+          filename: '逆变器信息',
+          type: 'csv',
+          isHeader: true,
+          isFooter: true,
+          data
         })
-      },
-      /*dataUpload(item) {
+        // this.loading = false
+      }).catch(e => {
+        // this.loading = false
+      })
+    },
+    /*dataUpload(item) {
 
-      },*/
-      importDataEvent(item) {
-        this.loadButton = true
-        const formData = new FormData()
-        formData.append('file', item.file)
-        // console.log('上传文件', item.file)
-        this.$axios.post('/console/importPvModuleModelCsv/', formData).then(res => {
-          this.$message({
-            message: '导入光伏组件信息成功',
-            type: 'success'
-          })
-        }).catch((error) => {
-          this.$message({
-            message: '导入光伏组件信息成功',
-            type: 'success'
-          })
+    },*/
+    importDataEvent(item) {
+      this.loadButton = true
+      const formData = new FormData()
+      formData.append('file', item.file)
+      // console.log('上传文件', item.file)
+      this.$axios.post('/console/importPvModuleModelCsv/', formData).then(res => {
+        this.$message({
+          message: '导入光伏组件信息成功',
+          type: 'success'
+        })
+      }).catch((error) => {
+        this.$message({
+          message: '导入光伏组件信息成功',
+          type: 'success'
         })
-        this.loadButton = false
-        /*  this.$refs.xTable.importData({ types: ['csv'] })*/
-      },
+      })
+      this.loadButton = false
+      /*  this.$refs.xTable.importData({ types: ['csv'] })*/
+    },
 
 
-    }
   }
+}
 </script>
 
 <style scoped>
 
-  .my_table_insert .vxe-body--row.is--new {
-    background-color: #f1fdf1;
-  }
+.my_table_insert .vxe-body--row.is--new {
+  background-color: #f1fdf1;
+}
 </style>

+ 5 - 0
ipfcst-console/src/main/frontend/views/console/weatherStationInfo/index.vue

@@ -42,6 +42,8 @@
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="name" title="名称"width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
+            <vxe-table-column field="equipmentNo" title="设备编号"width="13%"
+                              :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="manufacturer" title="生产商" width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="modelNumber" title="型号" width="13%"
@@ -182,6 +184,9 @@
           name: [
             {required: true, validator:checkName},
           ],
+          equipmentNo: [
+            {required: true, message: '设备编号不能为空'},
+          ],
           manufacturer: [
             {required: true, message: '制造商名称不能为空'},
           ],

+ 3 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/ReceiveDataJob.java

@@ -23,14 +23,14 @@ public class ReceiveDataJob {
   private ReceiveDataService receiveDataService;
 
 
-  @Scheduled(fixedDelay = 60000)
+  @Scheduled(cron = "0 0/1 * * * *")
   public void receiveData() {
 
-    log.debug("开始向绿能数据中心请求数据");
+    log.info("开始向绿能数据中心请求数据");
 
     this.receiveDataService.receive();
 
-    log.debug("数据请求结束");
+    log.info("数据请求结束");
 
   }
 

+ 2 - 1
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/DataPointService.java

@@ -1,6 +1,7 @@
 package com.jiayue.ipfcst.console.service;
 
 
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.DataPoint;
 import com.jiayue.ipfcst.common.data.repository.DataPointRepository;
 import com.jiayue.ipfcst.common.data.service.BaseService;
@@ -23,7 +24,7 @@ public class DataPointService extends BaseService {
    * 查询设备下所有测点
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public List<DataPoint> getByEquipmentType(Integer equipmentType) {
+  public List<DataPoint> getByEquipmentType(EquipmentTypeEnum equipmentType) {
     List<DataPoint> resultList;
     resultList = this.dataPointRepository.findAllByEquipmentType(equipmentType);
     return resultList;

+ 0 - 3
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterInfoService.java

@@ -61,9 +61,6 @@ public class InverterInfoService extends BaseService {
       inverterInfo1.setReport(inverterInfo.getReport());
       inverterInfo1.setInstallationTime(inverterInfo.getInstallationTime());
       inverterInfo1.setName(inverterInfo.getName() + "-" + i);
-      inverterInfo1.setBatteryModel(inverterInfo.getBatteryModel());
-      inverterInfo1.setBatteryNumber(inverterInfo.getBatteryNumber());
-      inverterInfo1.setBox(inverterInfo.getBox());
       inverterInfo1.setCapacity(inverterInfo.getCapacity());
       inverterInfo1.setCollectorCircuit(inverterInfo.getCollectorCircuit());
       inverterInfo1.setEfficiency(inverterInfo.getEfficiency());

+ 152 - 73
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ReceiveDataService.java

@@ -1,25 +1,30 @@
 package com.jiayue.ipfcst.console.service;
 
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONObject;
-import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.jiayue.ipfcst.common.core.util.DateTimeUtil;
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
 import com.jiayue.ipfcst.common.data.entity.*;
 import com.jiayue.ipfcst.common.data.repository.*;
-import com.jiayue.ipfcst.console.dto.ResponseResults;
-import com.jiayue.ipfcst.console.dto.ResponseRows;
 import com.jiayue.ipfcst.console.util.RedisUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.springframework.beans.factory.annotation.Value;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * 接收数据service类
@@ -58,6 +63,13 @@ public class ReceiveDataService {
   @Autowired
   PowerStationDataPackerContainer powerStationDataPackerContainer;
 
+  @Value("${receive.ip}")
+  private String ip;
+  @Value("${receive.port}")
+  private  String port;
+  @Value("${receive.path}")
+  private  String path;
+
   public void receive() {
     List<ElectricField> electricFieldList = electricFieldService.getAll();
     //每个场站请求一次
@@ -75,19 +87,19 @@ public class ReceiveDataService {
           //按设备请求
           for (WeatherStationInfo weatherStationInfo : weatherStationInfoList) {
             HashMap<String, Object> paramMap = new HashMap<>();
-            paramMap.put("deviceIds", weatherStationInfo.getEquipmentNo());
+            paramMap.put("deviceIds", new String[]{weatherStationInfo.getEquipmentNo()});
             paramMap.put("startTime", startTime);
             paramMap.put("endTime", endTime);
-            String body = HttpUtil.post("https://10.220.57.13:7085/dataService/v1/getTaosData", paramMap);
-            AnalysisData(body, weatherStationInfo.getId(), weatherStationInfo.getEquipmentType().getCode(), electricField);
+            String body = httpClient(paramMap);
+            AnalysisData(body, weatherStationInfo.getId(), weatherStationInfo.getEquipmentType(), electricField);
           }
           for (InverterInfo inverterInfo : inverterInfoList) {
             HashMap<String, Object> paramMap = new HashMap<>();
             paramMap.put("deviceIds", inverterInfo.getEquipmentNo());
             paramMap.put("startTime", startTime);
             paramMap.put("endTime", endTime);
-            String body = HttpUtil.post("https://10.220.57.13:7085/dataService/v1/getTaosData", paramMap);
-            AnalysisData(body, inverterInfo.getId(), inverterInfo.getEquipmentType().getCode(), electricField);
+            String body = httpClient(paramMap);
+            AnalysisData(body, inverterInfo.getId(), inverterInfo.getEquipmentType(), electricField);
           }
         } else {
           //测风塔
@@ -99,16 +111,16 @@ public class ReceiveDataService {
             paramMap.put("deviceIds", windTowerInfo.getEquipmentNo());
             paramMap.put("startTime", startTime);
             paramMap.put("endTime", endTime);
-            String body = HttpUtil.post("https://10.220.57.13:7085/dataService/v1/getTaosData", paramMap);
-            AnalysisData(body, windTowerInfo.getId(), windTowerInfo.getEquipmentType().getCode(), electricField);
+            String body = httpClient(paramMap);
+            AnalysisData(body, windTowerInfo.getId(), windTowerInfo.getEquipmentType(), electricField);
           }
           for (WindTurbineInfo windTurbineInfo : windTurbineInfoList) {
             HashMap<String, Object> paramMap = new HashMap<>();
             paramMap.put("deviceIds", windTurbineInfo.getEquipmentNo());
             paramMap.put("startTime", startTime);
             paramMap.put("endTime", endTime);
-            String body = HttpUtil.post("https://10.220.57.13:7085/dataService/v1/getTaosData", paramMap);
-            AnalysisData(body, windTurbineInfo.getId(), windTurbineInfo.getEquipmentType().getCode(), electricField);
+            String body = httpClient(paramMap);
+            AnalysisData(body, windTurbineInfo.getId(), windTurbineInfo.getEquipmentType(), electricField);
           }
         }
         savePowerStationStatusData(electricField);
@@ -121,78 +133,146 @@ public class ReceiveDataService {
   /**
    * 解析数据
    *
-   * @param boby          所有数据
+   * @param body          所有数据
    * @param equipmentId   设备id
    * @param equipmentType 设备类型
    * @param electricField 场站对象
    */
-  public void AnalysisData(String boby, Integer equipmentId, Integer equipmentType, ElectricField electricField) {
+  public void AnalysisData(String body, Integer equipmentId, EquipmentTypeEnum equipmentType, ElectricField electricField) {
     try {
       List<DataPoint> dataPointList = dataPointService.getByEquipmentType(equipmentType);
-      JSONObject jsonObject = JSONUtil.parseObj(boby);
-      ResponseResults results = (ResponseResults) jsonObject.get("results");
-      ResponseRows rows = results.getRows();
-      String[] value = rows.getValues();
-      String[] sensorIds = results.getSensorIds();
+      JSONObject jsonObject= JSON.parseObject(body);
+      JSONArray jsonResults = (JSONArray) jsonObject.get("results");
+      JSONObject jsonObj = jsonResults.getJSONObject(0);
+      JSONArray jsonRows = (JSONArray) jsonObj.get("rows");
+      //所有设备点位
+      JSONArray sensorIds = (JSONArray) jsonObj.get("sensorIds");
+      JSONObject values;
       Map<String, String> map = new HashMap<>();
-      map.put("equipmentNo", equipmentId.toString());
-      map.put("time", new Date(rows.getTimestamp()).toString());
-      log.info("循环点表");
-      for (DataPoint dataPoint : dataPointList) {
-        for (int i = 0; i < sensorIds.length; i++) {
-          if (dataPoint.getMeasuringPoint().equals(sensorIds[i])) {
-            map.put(dataPoint.getEquipmentAttribute().getFieldName(), value[i]);
+      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+      if (jsonRows.size()>0){
+        values = jsonRows.getJSONObject(0);
+        //设备id
+        //String deviceId = jsonObj.getString("deviceId");
+        //时间戳
+        String time = values.getString("timestamp");
+        //所有数据
+        JSONArray jsonValues = (JSONArray) values.get("values");
+        long timestamp = Long.parseLong(time);
+
+        map.put("equipmentNo", equipmentId.toString());
+        map.put("time", simpleDateFormat.format(timestamp));
+
+        for (DataPoint dataPoint : dataPointList) {
+          for (int i = 0; i < sensorIds.size(); i++) {
+            if (dataPoint.getMeasuringPoint().equals(sensorIds.get(i))) {
+              if(jsonValues.get(i) == null ){
+                map.put(dataPoint.getEquipmentAttribute().getFieldName(), "-99");
+              }else{
+                map.put(dataPoint.getEquipmentAttribute().getFieldName(), jsonValues.get(i).toString());
+              }
+            }
           }
         }
-      }
-      //光
-      if (electricField.getElectricFieldTypeEnum().getCode() == 1) {
-        WeatherStationInfo weatherStationInfo = weatherStationInfoService.get(equipmentId);
-        if (weatherStationInfo != null) {
-          redisUtils.hmset("qxz-" + electricField.getStationCode() + "-" + equipmentId, map);
-          WeatherStationStatusData weatherStationStatusData = JSON.parseObject(JSON.toJSONString(map), WeatherStationStatusData.class);
-          weatherStationStatusDataRepository.save(weatherStationStatusData);
-        } else {
-          InverterInfo inverterInfo = inverterInfoService.get(equipmentId);
-          log.info("计算电压");
-          if (map.get("activePower") != null && map.get("electricalCurrent") != null) {
-            //有功
-            BigDecimal activePower = new BigDecimal(map.get("activePower"));
-            //电流
-            BigDecimal electricalCurrent = new BigDecimal(map.get("electricalCurrent"));
-            //有功/电流=电压
-            BigDecimal voltage = activePower.divide(electricalCurrent, 2, BigDecimal.ROUND_HALF_UP);
-            map.put("voltage", voltage.toString());
-          }
-          log.info("电压等于" + map.get("voltage"));
-          if (inverterInfo != null) {
-            redisUtils.hmset("nbq-" + electricField.getStationCode() + "-" + equipmentId, map);
-            InverterStatusData inverterStatusData = JSON.parseObject(JSON.toJSONString(map), InverterStatusData.class);
-            inverterStatusDataRepository.save(inverterStatusData);
+      }else{
+        log.info("该设备没有数据");
+        map.put("stationCode",electricField.getStationCode());
+        map.put("equipmentId", equipmentId.toString());
+        map.put("time", simpleDateFormat.format(new Date().getTime()));
+        for (DataPoint dataPoint : dataPointList) {
+          for (Object sensorId : sensorIds) {
+            if (dataPoint.getMeasuringPoint().equals(sensorId)) {
+              map.put(dataPoint.getEquipmentAttribute().getFieldName(), "-99");
+            }
           }
         }
-      } else {
-        //风
-        WindTurbineInfo windTurbineInfo = windTurbineInfoService.get(equipmentId);
-        if (windTurbineInfo != null) {
-          redisUtils.hmset("fj-" + electricField.getStationCode() + "-" + equipmentId, map);
-          WindTurbineStatusData windTurbineStatusData = JSON.parseObject(JSON.toJSONString(map), WindTurbineStatusData.class);
-          windTurbineStatusDataRepository.save(windTurbineStatusData);
-        } else {
-          WindTowerInfo windTowerInfo = windTowerInfoService.get(equipmentId);
-          if (windTowerInfo != null) {
-            redisUtils.hmset("cft-" + electricField.getStationCode() + "-" + equipmentId, map);
-            WindTowerStatusData windTowerStatusData = JSON.parseObject(JSON.toJSONString(map), WindTowerStatusData.class);
-            windTowerStatusDataRepository.save(windTowerStatusData);
-          }
+      }
+      switch (map.get("status")) {
+        case "1.00":
+        case "true":
+          //运行
+          map.put("status", "1");
+          break;
+        case "2.00":
+          //待机
+          map.put("status", "2");
+          break;
+        case "3.00":
+          //停用
+          map.put("status", "3");
+          break;
+        case "4.00":
+        case "false":
+          //故障
+          map.put("status", "4");
+          break;
+        case "-99":
+          map.put("status", "5");
+          break;
+      }
+      //光
+      if(equipmentType.getCode() == 1){
+
+        //气象站
+        redisUtils.hmset("qxz-" + electricField.getStationCode() + "-" + equipmentId, map);
+        WeatherStationStatusData weatherStationStatusData = JSON.parseObject(JSON.toJSONString(map), WeatherStationStatusData.class);
+        weatherStationStatusDataRepository.save(weatherStationStatusData);
+        log.info("qxz-" + electricField.getStationCode() + "-" + equipmentId+"已存入");
+      }else if (equipmentType.getCode() == 2){
+        //逆变器
+        if (map.get("activePower") != null && map.get("electricalCurrent") != null) {
+          //有功
+          BigDecimal activePower = new BigDecimal(map.get("activePower"));
+          //电流
+          BigDecimal electricalCurrent = new BigDecimal(map.get("electricalCurrent"));
+          //有功/电流=电压
+          BigDecimal voltage = activePower.divide(electricalCurrent, 2, BigDecimal.ROUND_HALF_UP);
+          map.put("voltage", voltage.toString());
         }
+        redisUtils.hmset("nbq-" + electricField.getStationCode() + "-" + equipmentId, map);
+        InverterStatusData inverterStatusData = JSON.parseObject(JSON.toJSONString(map), InverterStatusData.class);
+        inverterStatusDataRepository.save(inverterStatusData);
+        log.info("nbq-" + electricField.getStationCode() + "-" + equipmentId+"已存入");
+      }
+      if(equipmentType.getCode() == 4){
+        redisUtils.hmset("fj-" + electricField.getStationCode() + "-" + equipmentId, map);
+        WindTurbineStatusData windTurbineStatusData = JSON.parseObject(JSON.toJSONString(map), WindTurbineStatusData.class);
+        windTurbineStatusDataRepository.save(windTurbineStatusData);
+        log.info("fj-" + electricField.getStationCode() + "-" + equipmentId+"已存入");
+      } else if(equipmentType.getCode() == 3){
+        redisUtils.hmset("cft-" + electricField.getStationCode() + "-" + equipmentId, map);
+        WindTowerStatusData windTowerStatusData = JSON.parseObject(JSON.toJSONString(map), WindTowerStatusData.class);
+        windTowerStatusDataRepository.save(windTowerStatusData);
+        log.info("cft-" + electricField.getStationCode() + "-" + equipmentId+"已存入");
       }
     } catch (Exception e) {
-      log.info("程序异常");
+      log.info("接数程序异常");
       e.printStackTrace();
     }
   }
 
+  /**
+   * 发http请求
+   * @param paramMap 参数
+   * @return 返回的数据
+   */
+  public String httpClient( HashMap<String, Object> paramMap){
+    String body = "";
+    try{
+      CloseableHttpClient  httpClient = HttpClientBuilder.create().build();
+      HttpPost httpPost = new HttpPost("http://"+ip+":"+port+path);
+      StringEntity entity = new StringEntity(JSON.toJSONString(paramMap),"UTF-8");
+      httpPost.setEntity(entity);
+      httpPost.setHeader("Content-Type", "application/json; charset=utf-8");
+      CloseableHttpResponse response;
+      response = httpClient.execute(httpPost);
+      HttpEntity responseEntity = response.getEntity();
+      body = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
+    }catch (Exception e){
+      e.printStackTrace();
+    }
+    return body;
+  }
   public void savePowerStationStatusData(ElectricField electricField) {
     try {
       log.info("开始计算实际功率");
@@ -227,6 +307,5 @@ public class ReceiveDataService {
     } catch (Exception e) {
       e.printStackTrace();
     }
-
   }
 }

+ 5 - 0
ipfcst-console/src/main/resources/application.yml

@@ -115,3 +115,8 @@ fileupload:
     # 服务端等待接收信息的时间,单位:秒
     readerIdleTime: 60
 
+receive:
+  ip: 10.220.57.13
+  port: 7085
+  path: /dataService/v1/getTaosData
+

+ 20 - 20
ipfcst-console/src/main/resources/sql/t_data_point.sql

@@ -1,40 +1,40 @@
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.PwrAt.Ra.F32', 2, 3100);
+VALUES ('SC_PwrAt_Ra_F32', 2, 3100);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.PwrReact.Ra.F32', 2, 3101);
+VALUES ('SC_PwrReact_Ra_F32', 2, 3101);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.PF.Ra.F32', 2, 3102);
+VALUES ('SC_PF_Ra_F32', 2, 3102);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.DC.Ra.F32', 2, 3104);
+VALUES ('SC_DC_Ra_F32', 2, 3104);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.Other.Ra.F32.day', 2, 3105);
+VALUES ('SC_Other_Ra_F32_day', 2, 3105);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.TotEgyAt.Wt.F32', 2, 3107);
+VALUES ('SC_TotEgyAt_Wt_F32', 2, 3107);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('SC.TurSt.Rs.S.QH', 2, 3099);
+VALUES ('SC_TurSt_Rs_S_QH', 2, 3099);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.Temp.Ra.F32', 1, 1105);
+VALUES ('MELT_Temp_Ra_F32', 1, 1105);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.Hum.Ra.F32', 1, 1107);
+VALUES ('MELT_Hum_Ra_F32', 1, 1107);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.Pres.Ra.F32', 1, 1106);
+VALUES ('MELT_Pres_Ra_F32', 1, 1106);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.Wdir.Ra.F32', 1, 1110);
+VALUES ('MELT_Wdir_Ra_F32', 1, 1110);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.WSpd.Ra.F32', 1, 1109);
+VALUES ('MELT_WSpd_Ra_F32', 1, 1109);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.TRadio.Ra.F32', 1, 1101);
+VALUES ('MELT_TRadio_Ra_F32', 1, 1101);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.DRadio.Ra.F32', 1, 1102);
+VALUES ('MELT_DRadio_Ra_F32', 1, 1102);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.SRadio.Ra.F32', 1, 1103);
+VALUES ('MELT_SRadio_Ra_F32', 1, 1103);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.SSHour.Ra.F32.day', 1, 1111);
+VALUES ('MELT_SSHour_Ra_F32_day', 1, 1111);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.TRadio.Ra.F32.day', 1, 1112);
+VALUES ('MELT_TRadio_Ra_F32_day', 1, 1112);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.DRadio.Ra.F32.day', 1, 1113);
+VALUES ('MELT_DRadio_Ra_F32_day', 1, 1113);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.SRadio.Ra.F32.day', 1, 1114);
+VALUES ('MELT_SRadio_Ra_F32_day', 1, 1114);
 INSERT INTO t_data_point (C_MEASURING_POINT, C_EQUIPMENT_TYPE, C_EQUIPMENT_ATTRIBUTE_ID)
-VALUES ('MELT.Bool.Rd.b0.0004', 1, 1100);
+VALUES ('MELT_Bool_Rd_b0_0004', 1, 1100);