Преглед изворни кода

Merge remote-tracking branch 'origin/master'

wangtao пре 3 година
родитељ
комит
679454fedf
27 измењених фајлова са 2595 додато и 382 уклоњено
  1. 3 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ElectricField.java
  2. 79 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/EquipmentAttribute.java
  3. 67 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ProtocolGatherDataPoint.java
  4. 85 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/PvModuleModel.java
  5. 0 5
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/WindTurbineInfo.java
  6. 21 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/InverterStatusDataRepository.java
  7. 14 0
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/PvModuleModelRepository.java
  8. 1 1
      ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/WindTurbineStatusDataRepository.java
  9. 9 9
      ipfcst-console/README.md
  10. 38 15
      ipfcst-console/src/main/frontend/views/console/inverterInfo/index.vue
  11. 34 12
      ipfcst-console/src/main/frontend/views/console/pvModuleModel/index.vue
  12. 46 37
      ipfcst-console/src/main/frontend/views/console/weatherStationInfo/index.vue
  13. 35 34
      ipfcst-console/src/main/frontend/views/console/windTowerInfo/index.vue
  14. 31 8
      ipfcst-console/src/main/frontend/views/console/windTurbineInfo/index.vue
  15. 146 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java
  16. 165 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/PvModuleModelController.java
  17. 148 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationInfoController.java
  18. 103 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerInfoController.java
  19. 162 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineInfoController.java
  20. 2 2
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/DownLoadServiceJob.java
  21. 0 52
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/DownLoadService.java
  22. 285 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/InverterInfoService.java
  23. 131 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PvModuleModelService.java
  24. 142 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WeatherStationInfoService.java
  25. 149 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTowerInfoService.java
  26. 247 0
      ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTurbineInfoService.java
  27. 452 207
      ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/service/E63UploadFileService.java

+ 3 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ElectricField.java

@@ -27,6 +27,9 @@ public class ElectricField extends AbstractBaseEntity {
      * 备用字段B(站内受阻容量,不需要页面显示)
      */
     /**
+     * 备用字段C(用于绿能场站编号)
+     */
+    /**
      * 场站编号(运维标识,主键)
      */
     @Id

+ 79 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/EquipmentAttribute.java

@@ -0,0 +1,79 @@
+package com.jiayue.ipfcst.common.data.entity;
+
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+/**
+ * 各个装备的属性值提取出来
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+@Data
+@Entity
+public class EquipmentAttribute {
+
+    /**
+     * Id
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
+    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
+    Integer id;
+
+    /**
+     * 属性的定义
+     */
+    @Column(length = 50)
+    String explanation;
+
+
+    /**
+     * 属性所对应的的类的属性
+     */
+    @Column(length = 90)
+    String fieldName;
+
+
+    /**
+     * 计量单位
+     */
+    @Column(length = 5)
+    String measurementUnits;
+
+
+    /**
+     * Equipment type
+     */
+    @Column(length = 200)
+    @Enumerated(EnumType.STRING)
+    EquipmentTypeEnum equipmentType;
+
+    /**
+     * 场站标识
+     */
+    @Column
+    private String stationCode;
+
+    /**
+     * 字段类型
+     */
+    @Column()
+    @Enumerated(EnumType.STRING)
+    private EquipmentAttributeTypeEnum equipmentAttributeTypeEnum;
+
+    enum EquipmentAttributeTypeEnum{
+        /**
+         * INVARIANT 固定字段 不可修改的
+         * SPARE 备用字段
+         * CUSTOM 自定义字段
+         */
+         INVARIANT,SPARE,CUSTOM
+    }
+
+
+
+}

+ 67 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/ProtocolGatherDataPoint.java

@@ -0,0 +1,67 @@
+package com.jiayue.ipfcst.common.data.entity;
+
+import com.jiayue.ipfcst.common.data.constant.enums.DataSourceEnum;
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
+import lombok.Data;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+/**
+ * 通道采集点表
+ *
+ * @author 修唯xiuwei
+ * @version 3.0
+ */
+@Data
+@Entity
+public class ProtocolGatherDataPoint {
+
+    /**
+     * id主键
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
+    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
+    private Integer id;
+
+    /**
+     * 测点
+     */
+    @Column
+    private String measuringPoint;
+
+    /**
+     * 该测点对应的设备id
+     */
+    @Column(length = 5)
+    private Integer equipmentId;
+
+    /**
+     * 测点描述的设备属性
+     */
+    @OneToOne
+    @JoinColumn(name = "equipmentAttributeId", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
+    private EquipmentAttribute equipmentAttribute;
+
+
+    public EquipmentTypeEnum getEquipmentType() {
+        if (getEquipmentAttribute() == null) {
+            return null;
+        } else {
+            return this.getEquipmentAttribute().getEquipmentType();
+        }
+    }
+
+    public void setEquipmentType(EquipmentTypeEnum equipmentType) {
+        if (getEquipmentAttribute() == null) {
+            EquipmentAttribute att = new EquipmentAttribute();
+            att.setEquipmentType(equipmentType);
+            setEquipmentAttribute(att);
+        } else {
+            getEquipmentAttribute().setEquipmentType(equipmentType);
+        }
+    }
+
+
+}

+ 85 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/PvModuleModel.java

@@ -0,0 +1,85 @@
+package com.jiayue.ipfcst.common.data.entity;
+
+import com.jiayue.ipfcst.common.data.abst.AbstractBaseEntity;
+import com.jiayue.ipfcst.common.data.constant.enums.PvRotationModeEnum;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+import javax.validation.constraints.Digits;
+import java.math.BigDecimal;
+
+/**
+ * TODO
+ *
+ * @author yh
+ * @version 1.0
+ * @since 2019/12/11 12:54
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class PvModuleModel extends AbstractBaseEntity {
+    /**
+     * 光伏组件主键
+     * 自增
+     */
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "myid")
+    @GenericGenerator(name = "myid", strategy = "com.jiayue.ipfcst.common.data.entity.id.CustomIDGenerator")
+    @Column
+    private Integer id;
+
+    /*型号*/
+    @Column
+    private String model;
+
+    /*单个装机容量*/
+    @Column
+    private String singleCap;
+
+    /*最大工作电压*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal maximumExcitationVoltage;
+
+    /*最大工作电流*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal maximumPowerCurrent;
+
+    /*开路电压*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal openCircuitVoltage;
+
+    /*短路电流*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal shortCircuitCurrent;
+
+    /*组件工作效率*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal efficiencyOfWork;
+
+    /*旋转方式*/
+    @Column
+    @Enumerated(EnumType.STRING)
+    private PvRotationModeEnum rotationMode;
+
+    /*安装倾斜度*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal gradient;
+
+    /*单个光伏组件面积*/
+    @Column
+    @Digits(integer = 10, fraction = 2)
+    private BigDecimal singleArea;
+
+    @Column
+    private String stationCode;
+
+}

+ 0 - 5
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/entity/WindTurbineInfo.java

@@ -144,11 +144,6 @@ public class WindTurbineInfo extends AbstractEquipmentInfo {
     @Column
     private String divideIntoDifferentPeriod;
 
-
-    /**
-     * backupA 分期
-     */
-
     /**
      * backupB 额定功率
      */

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

@@ -0,0 +1,21 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.InverterStatusData;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 逆变器数据实体仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/6 13:00
+ */
+public interface InverterStatusDataRepository extends BaseRepository<InverterStatusData, Integer> {
+
+
+    List<InverterStatusData> findByTimeBetween(Date startTime, Date endTime);
+    List<InverterStatusData> findByTimeBetweenAndEquipmentNoIn(Date startTime, Date endTime, Integer[] no);
+    List<InverterStatusData> findByTimeBetweenAndEquipmentNo(Date startTime, Date endTime, String no);
+}

+ 14 - 0
ipfcst-common/ipfcst-common-data/src/main/java/com/jiayue/ipfcst/common/data/repository/PvModuleModelRepository.java

@@ -0,0 +1,14 @@
+package com.jiayue.ipfcst.common.data.repository;
+
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+
+/**
+ * 场站信息仓储
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/5 9:15
+ */
+public interface PvModuleModelRepository extends BaseRepository<PvModuleModel, Integer> {
+    PvModuleModel findByModel(String model);
+}

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

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

+ 9 - 9
ipfcst-console/README.md

@@ -2,7 +2,7 @@ Redis存储说明:
 ============================================
 **实际功率**
 
-存储格式->【power-场站编号-设备编号,属性map】
+存储格式->【power-场站编号,属性map】
 属性map:
 stationCode 场站编号
 time 时间
@@ -21,10 +21,10 @@ abnormalOfMeasuring 测风光法的异常值
 
 **气象站**
 
-存储格式->【qxz-场站编号-设备编号,属性map】
+存储格式->【qxz-场站编号-气象站ID,属性map】
 属性map:
 stationCode 场站编号
-equipmentNo 设备编号
+id 气象站ID
 time 时间
 globalR 总辐射
 directR 直接辐射
@@ -40,10 +40,10 @@ wd 风向
 
 **测风塔**
 
-存储格式->【cft-场站编号-设备编号,属性map】
+存储格式->【cft-场站编号-测风塔ID,属性map】
 属性map:
 stationCode 场站编号
-equipmentNo 设备编号
+id 测风塔ID
 time 时间
 tInst 温度瞬时值
 rhInst 湿度瞬时值
@@ -71,10 +71,10 @@ wdInstHubHeight 轮毂高度风向瞬时值
 
 **风机**
 
-存储格式->【fj-场站编号-设备编号,属性map】
+存储格式->【fj-场站编号-风机ID,属性map】
 属性map:
 stationCode 场站编号
-equipmentNo 设备编号
+id 风机ID
 time 时间
 status 状态
 activePower 有功
@@ -94,10 +94,10 @@ cumulativeGeneratedEnergy 累积发电量
 
 **逆变器**
 
-存储格式->【nbq-场站编号-设备编号,属性map】
+存储格式->【nbq-场站编号-逆变器ID,属性map】
 属性map:
 stationCode 场站编号
-equipmentNo 设备编号
+id 逆变器ID
 time 时间
 status 状态
 activePower 有功

+ 38 - 15
ipfcst-console/src/main/frontend/views/console/inverterInfo/index.vue

@@ -11,6 +11,18 @@
                      @click="exportDataEvent">导出数据
           </el-button>
         </div>
+        <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+        <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+          <el-option
+            v-for="item in stationList"
+            :key="item.stationCode"
+            :label="item.name"
+            :value="item.stationCode">
+            <span style="float: left">{{ item.name }}</span>
+            <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+          </el-option>
+        </el-select>
+        <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
           size="small"
@@ -44,6 +56,10 @@
             :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}">
             <vxe-table-column title="逆变器信息" align="center">
               <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"
@@ -184,6 +200,8 @@
         callback()
       }
       return {
+        stationCode: '',
+        stationList: [],
         id:'',
         currentPage: 1,
         pageSize: 10,
@@ -266,7 +284,8 @@
     },
 
     created() {
-      this.getData(this.currentPage, this.pageSize)
+      this.getStationList()
+      this.getData()
     },
     activated() {
       console.log("2激活activated钩子函数");
@@ -275,17 +294,21 @@
       console.log("2激活deactivated钩子函数");
     },
     methods: {
-      getData(currentPage, pageSize) {
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
+      getData() {
         this.loading = true
-        let url = currentPage + '/' + pageSize
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        let url = this.currentPage + '/' + this.pageSize + '/' + queryParam
         this.$axios.get('/inverterInfo/' + url).then(res => {
-          if (res.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-
           this.tableData = res.data.content
           this.total = res.data.totalElements
           this.loading = false
@@ -298,7 +321,7 @@
       handlePageChange({currentPage, pageSize}) {
         this.currentPage = currentPage
         this.pageSize = pageSize
-        this.getData(this.currentPage, this.pageSize)
+        this.getData()
       },
       getPvData() {
         this.$axios.get('/pvModuleModel/').then(res => {
@@ -432,7 +455,7 @@
                           type: 'success'
                         })
                         this.loadButton = false
-                        this.getData(this.currentPage, this.pageSize)
+                        this.getData()
                       }).catch((error) => {
                         this.$refs.xTable.setActiveRow(row)
                         this.$message.error('保存逆变器出错' + error)
@@ -456,7 +479,7 @@
                       type: 'success'
                     })
                     this.loadButton = false;
-                    this.getData(this.currentPage, this.pageSize)
+                    this.getData()
                   }).catch((error) => {
                     this.$refs.xTable.setActiveRow(row)
                     this.$message.error('修改逆变器出错' + error)
@@ -469,7 +492,7 @@
                       type: 'success'
                     })
                     this.loadButton = false;
-                    this.getData(this.currentPage, this.pageSize)
+                    this.getData()
                   }).catch((error) => {
                     this.$refs.xTable.setActiveRow(row)
                     this.$message.error('保存逆变器出错' + error)
@@ -511,7 +534,7 @@
             type: 'success'
           })
           this.delVisible = false
-          this.getData(this.currentPage, this.pageSize)
+          this.getData()
         }).catch((error) => {
           this.$message.error('删除逆变器信息出错' + error)
         })

+ 34 - 12
ipfcst-console/src/main/frontend/views/console/pvModuleModel/index.vue

@@ -15,10 +15,21 @@
                         <el-button :loading="loadButton"   type="text">导入数据</el-button>
                     </el-upload>-->
         </div>
-
-        <div class="filter-container">
+        <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+        <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+          <el-option
+            v-for="item in stationList"
+            :key="item.stationCode"
+            :label="item.name"
+            :value="item.stationCode">
+            <span style="float: left">{{ item.name }}</span>
+            <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+          </el-option>
+        </el-select>
+        <el-button type="primary" icon="el-icon-search" size="small" @click="getData">查询</el-button>
+<!--        <div class="filter-container">-->
           <el-button type="primary" size="small" style="round-clip: 10px" @click="insertEvent" :loading="loadButton">添加</el-button>
-        </div>
+<!--        </div>-->
         <div style="padding-top: 10px">
           <vxe-table
             ref="xTable"
@@ -36,6 +47,8 @@
             :edit-config="{trigger: 'manual', mode: 'row',autoClear:false,showStatus: true,icon:'none'}"
           >
             <vxe-table-column title="光伏组件信息" align="center">
+              <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                                :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
               <vxe-table-column
                 field="model"
                 title="组件型号"
@@ -215,6 +228,8 @@
         callback()
       }
       return {
+        stationCode: '',
+        stationList: [],
         id:'',
         total:0,
         pageSize: 10,
@@ -283,20 +298,27 @@
       }
     },
     created() {
-      this.getData(this.currentPage, this.pageSize)
+      this.getStationList()
+      this.getData()
     },
 
     methods: {
-      getData(currentPage, pageSize) {
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
+      getData() {
         this.loading = true
-        this.$axios.get('/pvModuleModel/' + currentPage + '/' + pageSize,).then((res) => {
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        this.$axios.get('/pvModuleModel/' + this.currentPage + '/' + this.pageSize + '/' + queryParam).then((res) => {
           this.tableData = res.data.content
-          if(res.data.content==''){
-            this.showTable = false
-          }else{
-            this.showTable = true
-          }
-          this.total = res.data.count
+          this.total = res.data.totalElements
           // console.log('获取光伏组件信息成功')
           this.getPvRotationMode()
           this.loading = false

+ 46 - 37
ipfcst-console/src/main/frontend/views/console/weatherStationInfo/index.vue

@@ -7,6 +7,18 @@
                    @click="exportDataEvent">导出数据
         </el-button>
       </div>
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" size="small" @click="queryInfo">查询</el-button>
       <el-button type="primary" size="small" @click="insertEvent" style="round-clip: 10px"
                  :loading="btnLonding">新增</el-button>
       <div style="padding-top: 10px">
@@ -26,13 +38,15 @@
           :edit-config="{trigger: 'manual', mode: 'row',autoClear: false,icon:'none'}"
         >
           <vxe-table-column title="气象站信息">
+            <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                              :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="manufacturer" title="生产商" width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="modelNumber" title="型号" width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-            <vxe-table-column min-width="60px" width="15%" field="installationTime" title="安装时间"
+            <vxe-table-column min-width="60px" width="10%" field="installationTime" title="安装时间"
                               :edit-render="{props: {type: 'default'}}">
               <template v-slot:edit="{ row }">
                 <el-date-picker
@@ -45,7 +59,7 @@
               </template>
               <template v-slot="{ row }">{{ timestampToTime(row.installationTime) }}</template>
             </vxe-table-column>
-            <vxe-table-column field="report" title="是否上报" width="8%"
+            <vxe-table-column field="report" title="是否上报" width="6%"
                               :edit-render="{name: '$select', options: options}"></vxe-table-column>
             <vxe-table-column field="bindTunnel" title="绑定通道" width="13%"
                               :edit-render="{name: '$select', options: bindTunnels}"
@@ -96,17 +110,6 @@
             </vxe-table-column>
           </vxe-table-column>
         </vxe-table>
-        <vxe-pager
-          perfect
-          :current-page.sync="currentPage"
-          :page-size.sync="pageSize"
-          :total="total"
-          :page-sizes=[10,50,100]
-          :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
-          @page-change="handlePageChange"
-          v-show="!btnLonding&&showTable"
-        >
-        </vxe-pager>
       </div>
 
     </el-card>
@@ -152,6 +155,8 @@
       }
       return {
         id:'',
+        stationCode: '',
+        stationList: [],
         equipmentTypeList: [],
         loading: false,
         saveLoding: false,
@@ -199,31 +204,40 @@
       }
     },
     created() {
-      this.getAll()
-
+      this.getStationList()
     },
     methods: {
-      getAll() {
-        this.$axios.get('/TunnelInfo/findbyMaster').then(res => {
-          this.bindTunnels = res.data
-        })
+      // 查询
+      queryInfo() {
+        // this.$axios.get('/TunnelInfo/findbyMaster').then(res => {
+        //   this.bindTunnels = res.data
+        // })
         this.loading = true
         this.saveLoding = false
-        this.$axios.get('/weatherStationInfo/' + this.currentPage + '/' + this.pageSize).then(response => {
-          if (response.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-
-          this.tableData = response.data.content
-
-          this.total = response.data.totalElements
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        this.$axios.get('/weatherStationInfo/' + queryParam).then(response => {
+          this.tableData = response.data
           this.loading = false
           this.btnLonding = false
         })
       },
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+            this.stationList = res.data
+          }).catch((error) => {
+            this.$message.error('获取场站下拉框出错' + error)
+          })
+      },
+      stationCodeChange() {
+        this.$axios.get('/uploadObject/getByStationCode/' + this.stationCode).then((res) => {
+          this.uploadObjectId=''
+          this.uploadFileType=''
+          this.queryUploadObject = res.data
+        })
+      },
       editRowEvent(row) {
         this.id = row.id
         this.btnLonding = true
@@ -236,14 +250,14 @@
           if (valid) {
             if (row.id == undefined) {
               this.$axios.post('/weatherStationInfo/', row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.btnLonding = false
                 this.$XModal.message({status: 'warning', message: response.message})
               })
             } else {
               row.equipmentType = row.equipmentType.code
               this.$axios.put('/weatherStationInfo/', row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.$XModal.message({status: 'warning', message: response.message})
                 this.saveLoding = false
               })
@@ -297,11 +311,6 @@
         this.$refs.xTable.insert({interval: 60})
           .then(({row}) => this.$refs.xTable.setActiveRow(row))
       },
-      handlePageChange({currentPage, pageSize}) {
-        this.currentPage = currentPage
-        this.pageSize = pageSize
-        this.getAll()
-      },
       exportDataEvent() {
         this.loading = true
         this.$axios.get('/weatherStationInfo/').then(res => {

+ 35 - 34
ipfcst-console/src/main/frontend/views/console/windTowerInfo/index.vue

@@ -7,6 +7,18 @@
                    @click="exportDataEvent">导出数据
         </el-button>
       </div>
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" size="small" @click="queryInfo">查询</el-button>
       <el-button type="primary" size="small" @click="insertEvent" style="round-clip: 10px"
                  :loading="btnLonding">新增</el-button>
       <div style="padding-top: 10px">
@@ -26,13 +38,15 @@
           :edit-config="{trigger: 'manual', mode: 'row',autoClear: false,icon:'none'}"
         >
           <vxe-table-column title="测风塔信息">
+            <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                              :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="manufacturer" title="生产商"  width="13%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column field="modelNumber" title="型号"  width="10%"
                               :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
-            <vxe-table-column min-width="50px"  width="14%" field="installationTime" title="安装时间"
+            <vxe-table-column min-width="50px"  width="10%" field="installationTime" title="安装时间"
                               :edit-render="{props: {type: 'default'}}">
               <template v-slot:edit="{ row }">
                 <el-date-picker
@@ -97,17 +111,6 @@
             </vxe-table-column>
           </vxe-table-column>
         </vxe-table>
-        <vxe-pager
-          perfect
-          :current-page.sync="currentPage"
-          :page-size.sync="pageSize"
-          :total="total"
-          :page-sizes=[10,50,100]
-          :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
-          @page-change="handlePageChange"
-          v-show="!btnLonding&&showTable"
-        >
-        </vxe-pager>
       </div>
 
     </el-card>
@@ -163,6 +166,8 @@
         }
       }
       return {
+        stationCode: '',
+        stationList: [],
         bindTunnels:[],
         id:'',
         equipmentTypeList:[],
@@ -208,24 +213,18 @@
       }
     },
     created() {
-      this.getAll()
+      this.getStationList()
     },
     methods: {
-      getAll() {
-        this.$axios.get('/TunnelInfo/findbyMaster').then(res => {
-          this.bindTunnels = res.data
-        })
+      // 查询
+      queryInfo() {
         this.loading = true
         this.saveLoding = false
-        this.$axios.get('/windTowerInfo/' + this.currentPage + '/' + this.pageSize,).then(response => {
-          if (response.data.content == "") {
-            this.showTable = false
-
-          } else {
-            this.showTable = true
-          }
-          // window.console.log(this.equipmentTypeList)
-          this.tableData = response.data.content
+        let queryParam = this.stationCode;
+        if (queryParam==''){
+          queryParam="ALL"
+        }
+        this.$axios.get('/windTowerInfo/' + queryParam).then(response => {
           for (let i = 0; i < this.tableData.length; i++) {
             //添加省调枚举标识转换
             for (let j = 0; j < this.equipmentTypeList.length; j++) {
@@ -234,11 +233,18 @@
               }
             }
           }
-          this.total = response.data.totalElements
+          this.tableData = response.data
           this.loading = false
           this.btnLonding = false
         })
       },
+      getStationList() {
+        this.$axios.get('/electricField/getElectricField').then((res) => {
+          this.stationList = res.data
+        }).catch((error) => {
+          this.$message.error('获取场站下拉框出错' + error)
+        })
+      },
       editRowEvent(row) {
         this.id = row.id
         this.btnLonding = true
@@ -250,14 +256,14 @@
           if (valid) {
             if (row.id == undefined) {
               this.$axios.post('windTowerInfo/',row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.btnLonding = false
                 this.$XModal.message({status: 'warning', message: response.message})
               })
             } else {
               row.equipmentType = row.equipmentType.code
               this.$axios.put('windTowerInfo/',row).then(response => {
-                this.getAll()
+                this.queryInfo()
                 this.$XModal.message({status: 'warning', message: response.message})
                 this.saveLoding = false
               })
@@ -310,11 +316,6 @@
         this.$refs.xTable.insert({interval: 60})
           .then(({row}) => this.$refs.xTable.setActiveRow(row))
       },
-      handlePageChange({currentPage, pageSize}) {
-        this.currentPage = currentPage
-        this.pageSize = pageSize
-        this.getAll()
-      },
       exportDataEvent() {
         this.loading = true
         this.$axios.get('/windTowerInfo/').then(res => {

+ 31 - 8
ipfcst-console/src/main/frontend/views/console/windTurbineInfo/index.vue

@@ -6,6 +6,18 @@
         <el-button style="float: right;padding:3px 10px 3px 3px;" type="text" @click="exportDataEvent">导出数据
         </el-button>
       </div>
+      <span style="font-weight: bold;font-size: 14px">场站名称:</span>
+      <el-select style="width:250px" clearable v-model="stationCode" size="small" >
+        <el-option
+          v-for="item in stationList"
+          :key="item.stationCode"
+          :label="item.name"
+          :value="item.stationCode">
+          <span style="float: left">{{ item.name }}</span>
+          <span style="float: right; color: #8492a6;font-size: 13px">{{ item.stationCode }}</span>
+        </el-option>
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" size="small" @click="getAll">查询</el-button>
       <el-button
         type="primary"
         size="small"
@@ -68,6 +80,8 @@
         >
           <vxe-table-column title="风机信息">
             <vxe-table-column type="checkbox" width="3%"/>
+            <vxe-table-column field="stationCode" title="场站编号" width="6%"
+                              :edit-render="{name: '$input', attrs: {type: 'text'}}"></vxe-table-column>
             <vxe-table-column
               field="name"
               width="10%"
@@ -81,9 +95,9 @@
               :edit-render="{name:'$input',attrs:{type:'text'}}"
             />
             <vxe-table-column
-              field="backupA"
+              field="equipmentNo"
               width="10%"
-              title="分期"
+              title="设备编号"
               :edit-render="{name:'$input',attrs:{type:'text'}}"
             />
             <vxe-table-column
@@ -347,6 +361,8 @@ export default {
       callback()
     }
     return {
+      stationCode: '',
+      stationList: [],
       delVisible: false,
       piadd: false,
       id: '',
@@ -469,18 +485,25 @@ export default {
     }
   },
   created() {
+    this.getStationList()
     this.getAll()
   },
   methods: {
+    getStationList() {
+      this.$axios.get('/electricField/getElectricField').then((res) => {
+        this.stationList = res.data
+      }).catch((error) => {
+        this.$message.error('获取场站下拉框出错' + error)
+      })
+    },
     getAll() {
       this.loading = true
       this.saveLoding = false
-      this.$axios.get('/windTurbineInfo/' + this.currentPage + '/' + this.pageSize).then(response => {
-        if (response.data.content == '') {
-          this.showTable = false
-        } else {
-          this.showTable = true
-        }
+      let queryParam = this.stationCode;
+      if (queryParam==''){
+        queryParam="ALL"
+      }
+      this.$axios.get('/windTurbineInfo/' + this.currentPage + '/' + this.pageSize+ '/' + queryParam).then(response => {
         this.loading = false
         // window.console.log(response.data.content)
         this.tableData = response.data.content

+ 146 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/InverterInfoController.java

@@ -0,0 +1,146 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.console.service.InverterInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 逆变器restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/28 10:12
+ */
+@RestController
+@Slf4j
+public class InverterInfoController {
+
+    private final InverterInfoService inverterInfoService;
+
+    @Autowired
+    public InverterInfoController(InverterInfoService inverterInfoService) {
+        this.inverterInfoService = inverterInfoService;
+    }
+
+    /**
+     * 获取逆变器(分页)
+     *
+     * @return 执行结果
+     */
+    @GetMapping(value = {"inverterInfo/{page}/{size}/{stationCode}"})
+    public ResponseVO getPageAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
+      InverterInfo inverterInfo = new InverterInfo();
+      if (!"ALL".equals(stationCode)) {
+        inverterInfo.setStationCode(stationCode);
+      }
+      Page<InverterInfo> inverterPage = this.inverterInfoService.get(inverterInfo, page, size);
+      return ResponseVO.success(inverterPage);
+    }
+
+    /**
+     * 获取逆变器
+     *
+     * @return 执行结果
+     */
+    @GetMapping(value = {"inverterInfo"})
+    public ResponseVO getAll() {
+      List<InverterInfo> list = this.inverterInfoService.getAll();
+      return ResponseVO.success(list);
+    }
+
+    /**
+     * 保存逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "inverterInfo/")
+    public ResponseVO saveInverter(@RequestBody InverterInfo inverterInfo) {
+        try {
+            inverterInfoService.save(inverterInfo);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存逆变器信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 批量保存逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "inverterInfo/saveAll/{startValue}/{endValue}")
+    public ResponseVO allSaveInverter(@RequestBody InverterInfo inverterInfo,@PathVariable("startValue") Integer startValue,@PathVariable("endValue") Integer endValue) {
+        try {
+          inverterInfoService.addALL(inverterInfo,startValue,endValue);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存逆变器信息异常");
+            return ResponseVO.fail();
+        }
+    }
+
+
+    /**
+     * 更新逆变器信息
+     *
+     * @param inverterInfo 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PutMapping(value = "inverterInfo/")
+    public ResponseVO updateInverter(@RequestBody InverterInfo inverterInfo) {
+        try {
+            inverterInfoService.save(inverterInfo);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 更新逆变器信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+
+    /**
+     * 删除逆变器信息
+     *
+     * @param ids 删除id
+     * @return 执行结果
+     */
+    @SaveValidate
+    @DeleteMapping(value = "inverterInfo/{ids}")
+    public ResponseVO deleteInverter(@PathVariable("ids") String ids) {
+        try {
+            inverterInfoService.delete(ids);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 删除逆变器异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+
+}
+
+
+
+

+ 165 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/PvModuleModelController.java

@@ -0,0 +1,165 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.constant.enums.PvRotationModeEnum;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+import com.jiayue.ipfcst.console.service.PvModuleModelService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 光伏组件信息restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/28 10:12
+ */
+@RestController
+@Slf4j
+public class PvModuleModelController {
+
+    private final PvModuleModelService pvModuleModelService;
+
+    @Autowired public PvModuleModelController(PvModuleModelService pvModuleModelService) {
+        this.pvModuleModelService = pvModuleModelService;
+    }
+
+
+    /**
+     * 分页获取光伏组件信息
+     * @param size 条数
+     * @param page 页码
+     * @return 光伏组件信息
+     */
+
+    @GetMapping(value="pvModuleModel/{page}/{size}/{stationCode}")
+    public ResponseVO getPvModuleModel(@PathVariable("page")  Integer page,
+                                       @PathVariable("size")  Integer size, @PathVariable("stationCode") String stationCode) {
+      PvModuleModel pvModuleModel = new PvModuleModel();
+      if (!"ALL".equals(stationCode)) {
+        pvModuleModel.setStationCode(stationCode);
+      }
+
+      Page<PvModuleModel> pvModuleModelPage = this.pvModuleModelService.get(pvModuleModel, page, size);
+      return ResponseVO.success(pvModuleModelPage);
+    }
+
+
+    /**
+     * 获取光伏组件信息
+     *
+     * @return 光伏组件信息
+     */
+
+    @GetMapping(value="pvModuleModel/")
+    public ResponseVO getAll() {
+
+        try{
+            List<PvModuleModel> ps =  this.pvModuleModelService.getAll();
+
+            return ResponseVO.success(ps);
+        }catch (Exception e){
+            e.printStackTrace();
+            log.error(" 获取所有光伏组件异常");
+            return ResponseVO.success(null);
+        }
+
+    }
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param pvModuleModel 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PostMapping(value = "pvModuleModel/")
+    public ResponseVO savePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+        try {
+            pvModuleModelService.save(pvModuleModel);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 保存光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 更新光伏组件信息
+     *
+     * @param pvModuleModel 参数
+     * @return 执行结果
+     */
+    @SaveValidate
+    @PutMapping(value = "pvModuleModel/")
+    public ResponseVO updatePvModuleModel(@RequestBody PvModuleModel pvModuleModel) {
+        try {
+            pvModuleModelService.save(pvModuleModel);
+            return ResponseVO.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 更新光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+    /**
+     * 删除光伏组件信息
+     *
+     * @param ids 删除id
+     * @return 执行结果
+     */
+    @SaveValidate
+    @DeleteMapping(value="pvModuleModel/{ids}")
+    public ResponseVO deletePvModuleModel(@PathVariable("ids")String ids){
+        try{
+            pvModuleModelService.delete(ids);
+            return ResponseVO.success();
+        }catch(Exception e){
+            e.printStackTrace();
+            log.error(" 删除光伏组件信息异常");
+            return ResponseVO.fail();
+        }
+
+    }
+
+  /**
+   * 获取光伏组件旋转方式枚举
+   *
+   * @return 执行结果
+   */
+    @GetMapping(value = "getPvRotationMode/")
+    public ResponseVO getPvRotationMode() {
+        List<Map<String, Object>> provinceType = new ArrayList<>();
+        Map<String, Object> map;
+        try {
+            for (PvRotationModeEnum e : PvRotationModeEnum.values()) {
+                map = new HashMap<>();
+                map.put("label", e.getMessage());
+                map.put("key", e.name());
+                map.put("value", e.name());
+                provinceType.add(map);
+            }
+            return ResponseVO.success(provinceType);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(" 获取光伏组件旋转类型异常");
+            return ResponseVO.fail(provinceType);
+        }
+
+    }
+
+
+}

+ 148 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WeatherStationInfoController.java

@@ -0,0 +1,148 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.console.service.WeatherStationInfoService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 环境监测仪restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/7 11:29
+ */
+@RestController
+@RequestMapping("/weatherStationInfo")
+@Slf4j
+public class WeatherStationInfoController {
+
+    private final WeatherStationInfoService weatherStationInfoService;
+
+    @Autowired
+    public WeatherStationInfoController(WeatherStationInfoService weatherStationInfoService) {
+        this.weatherStationInfoService = weatherStationInfoService;
+    }
+
+    /**
+     * 新增环境监测仪
+     *
+     * @param weatherStationInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PostMapping()
+    public ResponseVO add(@RequestBody WeatherStationInfo weatherStationInfo) {
+      try {
+        this.weatherStationInfoService.add(weatherStationInfo);
+        return ResponseVO.success(1);
+      } catch (Exception ex) {
+        log.error("系统错误" + ex);
+        return ResponseVO.error(ex);
+      }
+
+
+    }
+
+    /**
+     * 修改环境监测仪
+     *
+     * @param weatherStationInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PutMapping()
+    public ResponseVO update(@RequestBody WeatherStationInfo weatherStationInfo) {
+      try {
+        this.weatherStationInfoService.update(weatherStationInfo);
+        return ResponseVO.success(1);
+      } catch (Exception ex) {
+        log.error("系统错误" + ex);
+        return ResponseVO.error(ex);
+      }
+
+    }
+
+    /**
+     * 获取环境监测仪
+     *
+     * @param weatherStationInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @GetMapping("/ById")
+    public ResponseVO get(@RequestBody WeatherStationInfo weatherStationInfo) {
+        try {
+          weatherStationInfo = this.weatherStationInfoService.get(weatherStationInfo.getId());
+          return ResponseVO.success(weatherStationInfo);
+        } catch (Exception ex) {
+          log.error("系统错误" + ex);
+          return ResponseVO.error(ex);
+        }
+
+    }
+
+    /**
+     * 删除环境监测仪
+     *
+     * @param id 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @DeleteMapping("/{id}")
+    public ResponseVO delete(@PathVariable Integer id) {
+      try {
+        this.weatherStationInfoService.delete(id);
+        return ResponseVO.success(1);
+      } catch (Exception ex) {
+        log.error("系统错误" + ex);
+        return ResponseVO.error(ex);
+      }
+
+    }
+
+    /**RequestParams
+     * 获取环境监测仪
+     *
+     * @param stationCode 参数
+     * @return 执行结果
+     */
+    @GetMapping(value = "/{stationCode}")
+    public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
+        try {
+          List<WeatherStationInfo> weatherStationInfoPage = this.weatherStationInfoService.get(stationCode);
+          return ResponseVO.success(weatherStationInfoPage);
+        } catch (Exception ex) {
+          log.error("系统错误" + ex);
+          return ResponseVO.error(ex);
+        }
+
+    }
+
+  /**
+   * 获取环境监测仪
+   *
+   * @return 执行结果
+   */
+  @GetMapping()
+  public ResponseVO getAll() {
+    try {
+      List<WeatherStationInfo> list = this.weatherStationInfoService.getAll();
+      return ResponseVO.success(list);
+    } catch (Exception ex) {
+      log.error("系统错误" + ex);
+      return ResponseVO.error(ex);
+    }
+
+  }
+}

+ 103 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTowerInfoController.java

@@ -0,0 +1,103 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.console.service.WindTowerInfoService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 测风塔restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/7 11:29
+ */
+@RestController
+@RequestMapping("windTowerInfo")
+@Slf4j public class WindTowerInfoController {
+
+    private final WindTowerInfoService windTowerInfoService;
+
+    @Autowired public WindTowerInfoController(WindTowerInfoService windTowerInfoService) {
+        this.windTowerInfoService = windTowerInfoService;
+    }
+
+    /**
+     * 新增测风塔
+     *
+     * @param windTowerInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PostMapping() public ResponseVO add(@RequestBody WindTowerInfo windTowerInfo) {
+        try {
+            this.windTowerInfoService.add(windTowerInfo);
+            return ResponseVO.success(1);
+        } catch (Exception ex) {
+            log.error("系统错误" + ex);
+            return ResponseVO.error(ex);
+        }
+
+    }
+
+    /**
+     * 修改测风塔
+     *
+     * @param windTowerInfo 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @PutMapping() public ResponseVO update(@RequestBody WindTowerInfo windTowerInfo) {
+        this.windTowerInfoService.update(windTowerInfo);
+        return ResponseVO.success(1);
+    }
+
+    /**
+     * 删除测风塔
+     *
+     * @param id 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @SaveValidate
+    @DeleteMapping("/{id}") public ResponseVO delete(@PathVariable Integer id) {
+        this.windTowerInfoService.delete(id);
+        return ResponseVO.success(1);
+    }
+
+    /**
+     * 获取测风塔
+     *
+     * @param stationCode 参数
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @GetMapping(value = "/{stationCode}")
+    public ResponseVO getAll(@PathVariable("stationCode") String stationCode) {
+      List<WindTowerInfo> windTowerPage = this.windTowerInfoService.get(stationCode);
+        return ResponseVO.success(windTowerPage);
+    }
+
+    /**
+     * 获取测风塔
+     *
+     * @return 执行结果
+     */
+    @SneakyThrows
+    @GetMapping(value = "")
+    public ResponseVO getAll() {
+
+      List<WindTowerInfo> list = this.windTowerInfoService.getAll();
+      return ResponseVO.success(list);
+    }
+}

+ 162 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/controller/WindTurbineInfoController.java

@@ -0,0 +1,162 @@
+package com.jiayue.ipfcst.console.controller;
+
+import com.jiayue.ipfcst.aop.SaveValidate;
+import com.jiayue.ipfcst.common.core.web.vo.RequestVO;
+import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
+import com.jiayue.ipfcst.common.data.constant.enums.EquipmentTypeEnum;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.console.service.WindTurbineInfoService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 风机restful接口
+ *
+ * @author tl
+ * @version 3.0
+ * @since 2020/6/7 11:29
+ */
+@RestController
+@RequestMapping("windTurbineInfo")
+@Slf4j
+public class WindTurbineInfoController {
+
+  private final WindTurbineInfoService windTurbineInfoService;
+
+  @Autowired
+  public WindTurbineInfoController(WindTurbineInfoService windTurbineInfoService) {
+    this.windTurbineInfoService = windTurbineInfoService;
+  }
+
+  /**
+   * 新增风机
+   *
+   * @param windTurbineInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PostMapping()
+  public ResponseVO add(@RequestBody WindTurbineInfo windTurbineInfo) {
+    this.windTurbineInfoService.add(windTurbineInfo);
+    return ResponseVO.success(1);
+  }
+
+  /**
+   * 修改风机
+   *
+   * @param windTurbineInfo 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @PutMapping()
+  public ResponseVO update(@RequestBody WindTurbineInfo windTurbineInfo) {
+    this.windTurbineInfoService.update(windTurbineInfo);
+    return ResponseVO.success(1);
+  }
+
+  /**
+   * 获取风机
+   *
+   * @param requestVO 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping("ById")
+  public ResponseVO get(@RequestBody RequestVO<WindTurbineInfo> requestVO) {
+    WindTurbineInfo windTurbineInfo = requestVO.getData();
+    windTurbineInfo = this.windTurbineInfoService.get(windTurbineInfo.getId());
+    return ResponseVO.success(windTurbineInfo);
+  }
+
+  /**
+   * 删除风机
+   *
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @SaveValidate
+  @DeleteMapping("/{id}")
+  public ResponseVO delete(@PathVariable Integer id) {
+    this.windTurbineInfoService.delete(id);
+    return ResponseVO.success(1);
+  }
+
+  /**
+   * 获取风机
+   *
+   * @param page 参数
+   * @param size 参数
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping(value = "/{page}/{size}/{stationCode}")
+  public ResponseVO getAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size, @PathVariable("stationCode") String stationCode) {
+    WindTurbineInfo windTurbineInfo = new WindTurbineInfo();
+    if (!"ALL".equals(stationCode)) {
+      windTurbineInfo.setStationCode(stationCode);
+    }
+    Page<WindTurbineInfo> windTurbinePage = this.windTurbineInfoService.get(windTurbineInfo, page, size);
+    return ResponseVO.success(windTurbinePage);
+  }
+
+
+  /**
+   * 获取风机
+   *
+   * @return 执行结果
+   */
+  @SneakyThrows
+  @GetMapping()
+  public ResponseVO getAll() {
+    List<WindTurbineInfo> list = this.windTurbineInfoService.getAll();
+    return ResponseVO.success(list);
+  }
+
+  /**
+   * 批量保存逆变器信息
+   *
+   * @param windTurbineInfo 风机实体
+   * @return 执行结果
+   */
+  @SaveValidate
+  @PostMapping(value = "/saveAll/{startValue}/{endValue}")
+  public ResponseVO allSaveWindTurbineInfo(@RequestBody WindTurbineInfo windTurbineInfo, @PathVariable("startValue") Integer startValue, @PathVariable("endValue") Integer endValue) {
+    try {
+      windTurbineInfoService.addALL(windTurbineInfo, startValue, endValue);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error("批量保存风机信息异常");
+      return ResponseVO.fail();
+    }
+  }
+
+  /**
+   * 删除逆变器信息
+   *
+   * @param ids 删除id
+   * @return 执行结果
+   */
+  @SaveValidate
+  @DeleteMapping(value = "/deleteIds/{ids}")
+  public ResponseVO deleteWindTurbineInfo(@PathVariable("ids") String ids) {
+    try {
+      windTurbineInfoService.delete(ids);
+      return ResponseVO.success();
+    } catch (Exception e) {
+      e.printStackTrace();
+      log.error(" 删除逆变器异常");
+      return ResponseVO.fail();
+    }
+
+  }
+
+}

+ 2 - 2
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/job/DownLoadServiceJob.java

@@ -13,7 +13,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * 天气预报下载
+ * 天气预报下载 停用  现已由外网下发不主动下载
  *
  * @author whc
  * @version 3.0
@@ -28,7 +28,7 @@ public class DownLoadServiceJob {
 
     @Autowired
     private ElectricFieldService electricFieldService;
-    @Scheduled(cron = "0 0/15 * * * *")
+    //@Scheduled(cron = "0 0/15 * * * *")
     public void fxglFileAnalysis() {
 
         log.debug("天气预报文件下载定时任务开始执行");

+ 0 - 52
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/DownLoadService.java

@@ -73,58 +73,6 @@ public class DownLoadService {
     }
 	}
 
-  public void downloadJob() {
-
-  }
-
-  public static void main(String[] args) {
-    //@Valid注解启动后台校验,
-    ModelAndView modelAndView = new ModelAndView();
-    Long startT = System.currentTimeMillis();
-    log.info("下载RB文件开始,时间:" + DateTimeUtil.getStringDate());
-
-    String message = "下载成功!";
-    log.info("开始执行定时任务:http下载文件");
-    String body = HttpRequest.get("https://117.78.19.70:9010/client/getDownLoadFileAll/" + "J00059").execute().body();
-    JSONObject json = JSONUtil.parseObj(body);
-    String code = json.get("code").toString();
-    String data = json.get("data").toString();
-    if (code.equals("0") && data.length() > 0) {
-      JSONArray array = JSONUtil.parseArray(data);
-      List<FileCreateLog> list = array.toList(FileCreateLog.class);
-      Date date = new Date();
-      SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
-      String dir = "/Users/wanghongchen/fsdownload/"+"J00059"+"/"+"new/";
-      String dirBak = "/Users/wanghongchen/fsdownload/"+"J00059"+"/"+"backups/"+simpleDateFormat.format(date)+"/";
-      //循环backups下的文件,有文件则不下载
-      File fileDirectory = new File(dir);
-      if(!fileDirectory.exists()){
-        fileDirectory.mkdir();
-      }
-      File bakDirectory = new File(dirBak);
-      if(!bakDirectory.exists()){
-        bakDirectory.mkdir();
-      }
-      try {
-        for (FileCreateLog fileCreateLog : list) {
-          File file= new File(bakDirectory+File.separator+fileCreateLog.getFileName());
-          if(!file.exists()){
-            String url = "https://117.78.19.70:9010/client/getFileById?id=" + fileCreateLog.getId();
-            long a = HttpUtil.downloadFile(url, dir + File.separatorChar + fileCreateLog.getFileName());
-            if(a>0){
-              log.info("J00059"+"场站"+fileCreateLog.getFileName()+"文件下载成功");
-            }
-          }else{
-            log.info("文件已经下载过了");
-          }
-        }
-      } catch (Exception e) {
-        log.error("文件下载失败", e);
-      }
-    }
-
-
-  }
 
 
 }

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

@@ -0,0 +1,285 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.common.data.repository.InverterInfoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import javax.persistence.criteria.Predicate;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * 逆变器业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class InverterInfoService extends BaseService {
+    private final InverterInfoRepository inverterInfoRepository;
+
+    @Autowired
+    public InverterInfoService(InverterInfoRepository inverterInfoRepository) {
+        this.inverterInfoRepository = inverterInfoRepository;
+    }
+
+
+    /**
+     * 新增逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void add(InverterInfo inverterInfo) throws BusinessException {
+        this.inverterInfoRepository.save(inverterInfo);
+    }
+
+
+    /**
+     * 批量新增逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void addALL(InverterInfo inverterInfo, Integer startValue, Integer endValue) throws BusinessException {
+        for (int i = startValue; i < startValue + endValue; i++) {
+            InverterInfo inverterInfo1 = new InverterInfo();
+            inverterInfo1.setManufacturer(inverterInfo.getManufacturer());
+            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());
+            inverterInfo1.setGroupSeries(inverterInfo.getGroupSeries());
+            inverterInfo1.setSample(inverterInfo.getSample());
+            inverterInfo1.setModelNumber(inverterInfo.getModelNumber());
+            inverterInfo1.setInterval(inverterInfo.getInterval());
+            this.inverterInfoRepository.save(inverterInfo1);
+        }
+
+
+//        boolean b = this.inverterRepository.existsById(inverter.getNo());
+//        if (b) {// 逆变器编号已存在
+//            throw new BusinessException("逆变器编号已存在!");
+//        } else {
+//
+//        }
+    }
+
+    /**
+     * 修改逆变器
+     *
+     * @param inverterInfo 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void update(InverterInfo inverterInfo) throws BusinessException {
+        if (StringUtils.isEmpty(inverterInfo.getId())) {
+            throw new BusinessException("逆变器编号不能为空!");
+        } else {
+            this.inverterInfoRepository.save(inverterInfo);
+        }
+    }
+
+    /**
+     * 删除逆变器
+     *
+     * @param id 逆变器编号
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void delete(final Integer id) throws BusinessException {
+        if (StringUtils.isEmpty(id)) {
+            throw new BusinessException("逆变器编号不能为空!");
+        } else {
+            this.inverterInfoRepository.deleteById(id);
+        }
+    }
+
+    /**
+     * 查询逆变器
+     *
+     * @param id 逆变器编号
+     * @return 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public InverterInfo get(final Integer id) throws BusinessException {
+        Optional<InverterInfo> optional = this.inverterInfoRepository.findById(id);
+        if (optional.isPresent()) {
+            return optional.get();
+        } else {
+            throw new BusinessException("逆变器不存在!");
+        }
+    }
+
+    /*
+     *//**
+     * 查询逆变器【分页查询】
+     *
+     * @param inverter 查询条件
+     * @param page     页码
+     * @param size     每页记录数
+     * @return 分页结果
+     *//*
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Page<Inverter> get(final Inverter inverter, final Integer page, final Integer size) {
+        ExampleMatcher matcher = ExampleMatcher.matching()
+                .withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains())
+                .withMatcher("box", ExampleMatcher.GenericPropertyMatchers.contains())
+                .withMatcher("collectorCircuit", ExampleMatcher.GenericPropertyMatchers.contains());
+        Example<Inverter> example = Example.of(inverter, matcher);
+        Pageable pageable = PageRequest.of(page - 1, size);
+        return this.inverterRepository.findAll(example, pageable);
+    }*/
+
+
+    /**
+     * 查询逆变器【分页查询】
+     *
+     * @param page 页码
+     * @param size 每页记录数
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Page<InverterInfo> get(final InverterInfo inverterInfo, final Integer page, final Integer size) {
+      ExampleMatcher matcher =
+        ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+      Example<InverterInfo> example = Example.of(inverterInfo, matcher);
+      Pageable pageable = PageRequest.of(page - 1, size);
+      return this.inverterInfoRepository.findAll(example, pageable);
+    }
+
+    /**
+     * 查询逆变器【分页查询】
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<InverterInfo> getAll() {
+        return inverterInfoRepository.findAll();
+    }
+
+
+    /**
+     * 查询所有样板机逆变器 create by xiuwei
+     *
+     * @return 逆变器信息
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<InverterInfo> getAllSample() {
+        InverterInfo inverterInfo = new InverterInfo();
+        inverterInfo.setSample(true);
+        return inverterInfoRepository.findAll(Example.of(inverterInfo));
+    }
+
+
+    /**
+     * 查询条件
+     *
+     * @param sample 是否样板机
+     * @return 查询条件
+     */
+    private Specification<InverterInfo> getDemoQuerySpecification(Boolean sample) {
+        return (Specification<InverterInfo>) (root, criteriaQuery, cb) -> {
+            List<Predicate> predicates = new ArrayList<>();
+            if (null != sample) {
+                predicates.add(cb.equal(root.get("sample").as(Boolean.class), sample));
+            }
+
+            return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+        };
+    }
+
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param inverterInfo 光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void save(InverterInfo inverterInfo) {
+        this.inverterInfoRepository.save(inverterInfo);
+    }
+
+    /**
+     * 删除逆变器信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public boolean delete(String ids) {
+        boolean flag = false;
+        if (!StringUtils.isEmpty(ids)) {
+            String[] idArray = ids.split(",");
+            if (idArray != null && idArray.length > 0) {
+                for (String id : idArray) {
+                    this.inverterInfoRepository.deleteById(Integer.valueOf(id));
+                    log.info("删除逆变器ID为[" + id + "]成功!");
+
+                }
+                flag = true;
+            } else {
+                this.inverterInfoRepository.deleteById(Integer.valueOf(ids));
+                flag = true;
+                log.info("删除逆变器ID为[" + ids + "]成功!");
+            }
+        }
+
+        return flag;
+
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(InverterInfo bean) {
+//        InverterInfo inverterInfo = inverterInfoRepository.findByName(bean.getName());
+//        if (null != inverterInfo) {
+//            bean.setId(inverterInfo.getId());
+//        }
+        inverterInfoRepository.save(bean);
+    }
+
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(List<InverterInfo> beans) {
+        if(beans != null && beans.size() > 0){
+            inverterInfoRepository.deleteAll();
+            inverterInfoRepository.saveAll(beans);
+        }
+    }
+
+  /**
+   * 根据场站编号查询逆变器
+   *
+   * @param stationCode 场站编号
+   * @return
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<InverterInfo> getByStationCode(String stationCode) {
+    List<InverterInfo> resultList = new ArrayList<>();
+    resultList =  this.inverterInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)){
+      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    }
+    return resultList.stream().sorted(Comparator.comparing(InverterInfo::getStationCode)).collect(Collectors.toList());
+  }
+}

+ 131 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PvModuleModelService.java

@@ -0,0 +1,131 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.PvModuleModel;
+import com.jiayue.ipfcst.common.data.repository.PvModuleModelRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场站信息业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 9:53
+ */
+@Service
+@Slf4j
+public class PvModuleModelService extends BaseService {
+
+    private final PvModuleModelRepository pvModuleModelRepository;
+
+    @Autowired
+    public PvModuleModelService(PvModuleModelRepository pvModuleModelRepository) {
+        this.pvModuleModelRepository = pvModuleModelRepository;
+    }
+
+    /**
+     * 获取所有光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public List<PvModuleModel> getAll() {
+        return this.pvModuleModelRepository.findAll();
+    }
+
+    /**
+     * 保存光伏组件信息
+     *
+     * @param pvModuleModel 光伏组件信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void save(PvModuleModel pvModuleModel) {
+        this.pvModuleModelRepository.save(pvModuleModel);
+    }
+
+    /**
+     * 删除场站信息
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public boolean delete(String ids) {
+        boolean flag = false;
+        if (!StringUtils.isEmpty(ids)) {
+            String[] idArray = ids.split(",");
+            if (idArray != null && idArray.length > 0) {
+                for (String id : idArray) {
+                    this.pvModuleModelRepository.deleteById(Integer.valueOf(id));
+                    log.info("删除光伏组件ID为[" + id + "]成功!");
+
+                }
+                flag = true;
+            } else {
+                this.pvModuleModelRepository.deleteById(Integer.valueOf(ids));
+                flag = true;
+                log.info("删除光伏组件ID为[" + ids + "]成功!");
+            }
+        }
+
+        return flag;
+
+    }
+
+    /**
+     * 查询场站信息
+     *
+     * @return 场站信息
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Map<String, Object> get(@RequestParam(defaultValue = "1") Integer page,
+                                   @RequestParam(defaultValue = "10") Integer size) {
+        Map<String, Object> map = new HashMap<>();
+        Sort sort = Sort.by(Sort.Direction.ASC, "id");
+        Pageable pageable = PageRequest.of(page - 1, size, sort); //页码:前端从1开始,jpa从0开始,做个转换
+        Page pagepvModuleModel = pvModuleModelRepository.findAll(pageable);
+        map.put("content", pagepvModuleModel.getContent());// 结果集
+        map.put("count", pagepvModuleModel.getTotalElements());// 总记录数
+        return map;
+    }
+
+  /**
+   * 查询逆变器【分页查询】
+   *
+   * @param page 页码
+   * @param size 每页记录数
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Page<PvModuleModel> get(final PvModuleModel pvModuleModel, final Integer page, final Integer size) {
+    ExampleMatcher matcher =
+      ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+    Example<PvModuleModel> example = Example.of(pvModuleModel, matcher);
+    Pageable pageable = PageRequest.of(page - 1, size);
+    return this.pvModuleModelRepository.findAll(example, pageable);
+  }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(PvModuleModel bean) {
+//        PvModuleModel beanOld = pvModuleModelRepository.findByModel(bean.getModel());
+//        if (null != beanOld) {
+//            bean.setId(beanOld.getId());
+//        }
+        pvModuleModelRepository.save(bean);
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(List<PvModuleModel> beans) {
+        if(beans != null && beans.size() > 0){
+            pvModuleModelRepository.deleteAll();
+            pvModuleModelRepository.saveAll(beans);
+        }
+    }
+}

+ 142 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WeatherStationInfoService.java

@@ -0,0 +1,142 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.repository.WeatherStationInfoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * 环境监测仪业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class WeatherStationInfoService extends BaseService {
+  private final WeatherStationInfoRepository weatherStationInfoRepository;
+
+  @Autowired
+  public WeatherStationInfoService(WeatherStationInfoRepository weatherStationInfoRepository) {
+    this.weatherStationInfoRepository = weatherStationInfoRepository;
+  }
+
+
+  /**
+   * 新增环境监测仪
+   *
+   * @param weatherStationInfo 气象站
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void add(WeatherStationInfo weatherStationInfo) throws BusinessException {
+    this.weatherStationInfoRepository.save(weatherStationInfo);
+
+  }
+
+  /**
+   * 修改环境监测仪
+   *
+   * @param weatherStationInfo 监测仪
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void update(WeatherStationInfo weatherStationInfo) throws BusinessException {
+    if (StringUtils.isEmpty(weatherStationInfo.getId())) {
+      throw new BusinessException("环境监测仪编号不能为空!");
+    } else {
+      this.weatherStationInfoRepository.save(weatherStationInfo);
+    }
+  }
+
+  /**
+   * 删除环境监测仪
+   *
+   * @param id 监测仪编号
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void delete(final Integer id) throws BusinessException {
+    if (StringUtils.isEmpty(id)) {
+      throw new BusinessException("环境监测仪编号不能为空!");
+    } else {
+      this.weatherStationInfoRepository.deleteById(id);
+    }
+  }
+
+  /**
+   * 查询环境监测仪
+   *
+   * @param no 测风塔编号
+   * @return 逆变器
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public WeatherStationInfo get(final Integer no) throws BusinessException {
+    Optional<WeatherStationInfo> optional = this.weatherStationInfoRepository.findById(no);
+    if (optional.isPresent()) {
+      return optional.get();
+    } else {
+      throw new BusinessException("环境监测仪不存在!");
+    }
+  }
+
+  /**
+   * 查询环境监测仪【分页查询】
+   *
+   * @param stationCode 场站编号
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<WeatherStationInfo> get(String stationCode) {
+    List<WeatherStationInfo> resultList = new ArrayList<>();
+    resultList =  this.weatherStationInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)){
+      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    }
+    return resultList.stream().sorted(Comparator.comparing(WeatherStationInfo::getStationCode)).collect(Collectors.toList());
+  }
+
+  /**
+   * 查询环境监测仪
+   *
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<WeatherStationInfo> getAll() {
+    return this.weatherStationInfoRepository.findAll();
+  }
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(WeatherStationInfo bean) {
+//        WeatherStationInfo weatherStationInfo = weatherStationInfoRepository.findByName(bean.getName());
+//        if (null != weatherStationInfo) {
+//            bean.setId(weatherStationInfo.getId());
+//        }
+    weatherStationInfoRepository.save(bean);
+  }
+
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(List<WeatherStationInfo> beans) {
+    if(beans != null && beans.size() > 0){
+      weatherStationInfoRepository.deleteAll();
+      weatherStationInfoRepository.saveAll(beans);
+    }
+  }
+}

+ 149 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTowerInfoService.java

@@ -0,0 +1,149 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.WeatherStationInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.common.data.repository.WindTowerInfoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * 测风塔业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class WindTowerInfoService extends BaseService {
+  private final WindTowerInfoRepository windTowerInfoRepository;
+
+  @Autowired
+  public WindTowerInfoService(WindTowerInfoRepository windTowerInfoRepository) {
+    this.windTowerInfoRepository = windTowerInfoRepository;
+  }
+
+  /**
+   * 新增测风塔
+   *
+   * @param windTowerInfo 测风塔
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void add(WindTowerInfo windTowerInfo) throws BusinessException {
+
+    try {
+      this.windTowerInfoRepository.save(windTowerInfo);
+    } catch (Exception e) {
+      log.error("系统错误" + e);
+    }
+
+  }
+
+  /**
+   * 修改测风塔
+   *
+   * @param windTowerInfo 测风塔
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void update(WindTowerInfo windTowerInfo)
+    throws BusinessException {
+    if (StringUtils.isEmpty(windTowerInfo.getId())) {
+      throw new BusinessException("测风塔编号不能为空!");
+    } else {
+      this.windTowerInfoRepository.save(windTowerInfo);
+    }
+  }
+
+  /**
+   * 删除测风塔
+   *
+   * @param no 测风塔编号
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void delete(final Integer no) throws BusinessException {
+    if (StringUtils.isEmpty(no)) {
+      throw new BusinessException("测风塔编号不能为空!");
+    } else {
+      this.windTowerInfoRepository.deleteById(no);
+    }
+  }
+
+  /**
+   * 查询测风塔
+   *
+   * @param stationCode 场站编号
+   * @return
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<WindTowerInfo> get(String stationCode) {
+    List<WindTowerInfo> resultList = new ArrayList<>();
+    resultList =  this.windTowerInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)){
+      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    }
+    return resultList.stream().sorted(Comparator.comparing(WindTowerInfo::getStationCode)).collect(Collectors.toList());
+  }
+
+
+  /**
+   * 获取到所有的测风塔   create by xiuwei
+   *
+   * @return List<WindTowerInfo>  测风塔列表
+   */
+  public List<WindTowerInfo> getAll() {
+    return windTowerInfoRepository.findAll();
+  }
+
+
+  /**
+   * 查询测风塔【分页查询】
+   *
+   * @param windTower 查询条件
+   * @param page      页码
+   * @param size      每页记录数
+   * @return 分页结果
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Page<WindTowerInfo> get(
+    final WindTowerInfo windTower, final Integer page, final Integer size) {
+    ExampleMatcher matcher =
+      ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+    Example<WindTowerInfo> example = Example.of(windTower, matcher);
+    Pageable pageable = PageRequest.of(page - 1, size);
+    return this.windTowerInfoRepository.findAll(example, pageable);
+  }
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(WindTowerInfo bean) {
+//        WindTowerInfo windTowerInfo = windTowerInfoRepository.findByName(bean.getName());
+//        if (null != windTowerInfo) {
+//            bean.setId(windTowerInfo.getId());
+//        }
+    windTowerInfoRepository.save(bean);
+  }
+
+  @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+  public void saveCloud(List<WindTowerInfo> beans) {
+    if(beans != null && beans.size() > 0){
+      windTowerInfoRepository.deleteAll();
+      windTowerInfoRepository.saveAll(beans);
+    }
+  }
+}

+ 247 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/WindTurbineInfoService.java

@@ -0,0 +1,247 @@
+package com.jiayue.ipfcst.console.service;
+
+import com.jiayue.ipfcst.common.core.exception.BusinessException;
+import com.jiayue.ipfcst.common.data.entity.InverterInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTowerInfo;
+import com.jiayue.ipfcst.common.data.entity.WindTurbineInfo;
+import com.jiayue.ipfcst.common.data.repository.WindTurbineInfoRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.*;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * 风机业务层
+ *
+ * @author zzy
+ * @version 1.0
+ * @since 2019/8/7 10:58
+ */
+@Service
+@Slf4j
+public class WindTurbineInfoService extends BaseService {
+    private final WindTurbineInfoRepository windTurbineInfoRepository;
+
+    @Autowired
+    public WindTurbineInfoService(WindTurbineInfoRepository windTurbineInfoRepository) {
+        this.windTurbineInfoRepository = windTurbineInfoRepository;
+    }
+
+
+    /**
+     * 新增风机
+     *
+     * @param windTurbine 风机
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void add(WindTurbineInfo windTurbine) throws BusinessException {
+        this.windTurbineInfoRepository.save(windTurbine);
+//        boolean b = this.windTurbineRepository.existsById(windTurbine.getNo());
+//        if (b) {// 编号已存在
+//            throw new BusinessException("风机编号已存在!");
+//        } else {
+//            this.windTurbineRepository.save(windTurbine);
+//        }
+    }
+
+    /**
+     * 修改风机
+     *
+     * @param windTurbine 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void update(WindTurbineInfo windTurbine) throws BusinessException {
+        if (StringUtils.isEmpty(windTurbine.getId())) {
+            throw new BusinessException("风机编号不能为空!");
+        } else {
+            this.windTurbineInfoRepository.save(windTurbine);
+        }
+    }
+
+    /**
+     * 删除风机
+     *
+     * @param no 逆变器编号
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.SUPPORTS)
+    public void delete(final Integer no) throws BusinessException {
+        if (StringUtils.isEmpty(no)) {
+            throw new BusinessException("风机编号不能为空!");
+        } else {
+            this.windTurbineInfoRepository.deleteById(no);
+        }
+    }
+
+    /**
+     * 查询风机
+     *
+     * @param no 逆变器编号
+     * @return 逆变器
+     * @throws BusinessException 业务异常
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public WindTurbineInfo get(final Integer no) throws BusinessException {
+        Optional<WindTurbineInfo> optional = this.windTurbineInfoRepository.findById(no);
+        if (optional.isPresent()) {
+            return optional.get();
+        } else {
+            throw new BusinessException("风机不存在!");
+        }
+    }
+
+  /**
+   * 根据场站编号查询风机
+   *
+   * @param stationCode 场站编号
+   * @return
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<WindTurbineInfo> getByStationCode(String stationCode) {
+    List<WindTurbineInfo> resultList = new ArrayList<>();
+    resultList =  this.windTurbineInfoRepository.findAll();
+    if (!"ALL".equals(stationCode)){
+      resultList = resultList.stream().filter(s->s.getStationCode().equals(stationCode)).collect(Collectors.toList());
+    }
+    return resultList.stream().sorted(Comparator.comparing(WindTurbineInfo::getStationCode)).collect(Collectors.toList());
+  }
+
+    /**
+     * 查询风机【分页查询】
+     *
+     * @param windTurbine 查询条件
+     * @param page        页码
+     * @param size        每页记录数
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public Page<WindTurbineInfo> get(final WindTurbineInfo windTurbine, final Integer page, final Integer size) {
+        ExampleMatcher matcher =
+                ExampleMatcher.matching().withMatcher("modelNumber", ExampleMatcher.GenericPropertyMatchers.contains());
+        Example<WindTurbineInfo> example = Example.of(windTurbine, matcher);
+        Pageable pageable = PageRequest.of(page - 1, size);
+        return this.windTurbineInfoRepository.findAll(example, pageable);
+    }
+
+    /**
+     * 查询风机
+     *
+     * @return 分页结果
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<WindTurbineInfo> getAll() {
+        return this.windTurbineInfoRepository.findAll();
+    }
+
+
+    /**
+     * 查询所有样板机风机 create by xiuwei
+     *
+     * @return 风机信息
+     */
+    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+    public List<WindTurbineInfo> getAllSample() {
+        WindTurbineInfo windTurbineInfo = new WindTurbineInfo();
+        windTurbineInfo.setSample(true);
+        return windTurbineInfoRepository.findAll(Example.of(windTurbineInfo));
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(WindTurbineInfo bean) {
+//        WindTurbineInfo beanOld = windTurbineInfoRepository.findByName(bean.getName());
+//        if (null != beanOld) {
+//            bean.setId(beanOld.getId());
+//        }
+        windTurbineInfoRepository.save(bean);
+    }
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    public void saveCloud(List<WindTurbineInfo> beans) {
+        if(beans != null && beans.size() > 0){
+            windTurbineInfoRepository.deleteAll();
+            windTurbineInfoRepository.saveAll(beans);
+        }
+    }
+
+  /**
+   * 批量新增逆变器
+   *
+   * @param windTurbineInfo 风机
+   * @throws BusinessException 业务异常
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public void addALL(WindTurbineInfo windTurbineInfo, Integer startValue, Integer endValue) throws BusinessException {
+    for (int i = startValue; i < startValue + endValue; i++) {
+      WindTurbineInfo windTurbineInfo1 = new WindTurbineInfo();
+      windTurbineInfo1.setManufacturer(windTurbineInfo.getManufacturer());
+      windTurbineInfo1.setReport(windTurbineInfo.getReport());
+      windTurbineInfo1.setInstallationTime(windTurbineInfo.getInstallationTime());
+      windTurbineInfo1.setName(windTurbineInfo.getName() + "" + i);
+      windTurbineInfo1.setAirDensity(windTurbineInfo.getAirDensity());
+      windTurbineInfo1.setCutInSpeed(windTurbineInfo.getCutInSpeed());
+      windTurbineInfo1.setCutOutSpeed(windTurbineInfo.getCutOutSpeed());
+      windTurbineInfo1.setGrade(windTurbineInfo.getGrade());
+      windTurbineInfo1.setHubHeight(windTurbineInfo.getHubHeight());
+      windTurbineInfo1.setLifeLength(windTurbineInfo.getLifeLength());
+      windTurbineInfo1.setRatedWindSpeed(windTurbineInfo.getRatedWindSpeed());
+      windTurbineInfo1.setSample(windTurbineInfo.getSample());
+      windTurbineInfo1.setModelNumber(windTurbineInfo.getModelNumber());
+      windTurbineInfo1.setLiveWindSpeed(windTurbineInfo.getLiveWindSpeed());
+      windTurbineInfo1.setMaxPower(windTurbineInfo.getMaxPower());
+      windTurbineInfo1.setParallelInDate(windTurbineInfo.getParallelInDate());
+      windTurbineInfo1.setWindWheelDiameter(windTurbineInfo.getWindWheelDiameter());
+      windTurbineInfo1.setWindWheelMaxSpeed(windTurbineInfo.getWindWheelMaxSpeed());
+      windTurbineInfo1.setWindWheelRatedSpeed(windTurbineInfo.getWindWheelRatedSpeed());
+      windTurbineInfo1.setWindWheelMinSpeed(windTurbineInfo.getWindWheelMinSpeed());
+      windTurbineInfo1.setInterval(windTurbineInfo.getInterval());
+      this.windTurbineInfoRepository.save(windTurbineInfo1);
+    }
+
+
+//        boolean b = this.inverterRepository.existsById(inverter.getNo());
+//        if (b) {// 逆变器编号已存在
+//            throw new BusinessException("逆变器编号已存在!");
+//        } else {
+//
+//        }
+  }
+
+  /**
+   * 批量删除风机信息
+   */
+  @Transactional(propagation = Propagation.SUPPORTS)
+  public boolean delete(String ids) {
+    boolean flag = false;
+    if (!StringUtils.isEmpty(ids)) {
+      String[] idArray = ids.split(",");
+      if (idArray != null && idArray.length > 0) {
+        for (String id : idArray) {
+          this.windTurbineInfoRepository.deleteById(Integer.valueOf(id));
+          log.info("删除风机ID为[" + id + "]成功!");
+
+        }
+        flag = true;
+      } else {
+        this.windTurbineInfoRepository.deleteById(Integer.valueOf(ids));
+        flag = true;
+        log.info("删除风机ID为[" + ids + "]成功!");
+      }
+    }
+
+    return flag;
+
+  }
+}

+ 452 - 207
ipfcst-console/src/main/java/com/jiayue/ipfcst/fileupload/service/E63UploadFileService.java

@@ -61,10 +61,16 @@ public class E63UploadFileService extends BaseUploadFileService {
 
   private final InverterInfoRepository inverterInfoRepository;
 
+  private final WindTurbineStatusDataRepository windTurbineStatusDataRepository;
+
+  private final InverterStatusDataRepository inverterStatusDataRepository;
+
+  private final PowerStationStatusDataRepository powerStationStatusDataRepository;
+
   @Autowired
   private RedisUtils redisUtils;
 
-  public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository, WindTowerInfoRepository windTowerInfoRepository, WindTowerStatusDataRepository windTowerStatusDataRepository, NwpRepository nwpRepository, InverterInfoRepository inverterInfoRepository) {
+  public E63UploadFileService(VelocityEngine velocityEngine, ForecastPowerShortTermService forecastPowerShortTermService, ForecastPowerUltraShortTermService forecastPowerUltraShortTermService, E63UploadFileRuleService e63UploadFileRuleService, WeatherStationInfoRepository weatherStationInfoRepository, WindTurbineInfoRepository windTurbineInfoRepository, WeatherStationStatusDataRepository weatherStationStatusDataRepository, WindTowerInfoRepository windTowerInfoRepository, WindTowerStatusDataRepository windTowerStatusDataRepository, NwpRepository nwpRepository, InverterInfoRepository inverterInfoRepository, WindTurbineStatusDataRepository windTurbineStatusDataRepository, InverterStatusDataRepository inverterStatusDataRepository, PowerStationStatusDataRepository powerStationStatusDataRepository) {
     this.velocityEngine = velocityEngine;
     this.forecastPowerShortTermService = forecastPowerShortTermService;
     this.forecastPowerUltraShortTermService = forecastPowerUltraShortTermService;
@@ -76,6 +82,9 @@ public class E63UploadFileService extends BaseUploadFileService {
     this.windTowerStatusDataRepository = windTowerStatusDataRepository;
     this.nwpRepository = nwpRepository;
     this.inverterInfoRepository = inverterInfoRepository;
+    this.windTurbineStatusDataRepository = windTurbineStatusDataRepository;
+    this.inverterStatusDataRepository = inverterStatusDataRepository;
+    this.powerStationStatusDataRepository = powerStationStatusDataRepository;
   }
 
   /**
@@ -147,7 +156,7 @@ public class E63UploadFileService extends BaseUploadFileService {
             template.merge(velocityContext, writer);
 
             // 将文件复制到上报路径中
-            super.copyUploadFile(writer, file, FileTypeEnum.E1.name(), null, systemDate, stationCode);
+            super.copyUploadFile(writer, file, FileTypeEnum.E1.name(), null, date, stationCode);
           }
         } else {
           log.error(stationCode + "短期上报模板不存在!");
@@ -220,7 +229,7 @@ public class E63UploadFileService extends BaseUploadFileService {
             writer = new StringWriter();
             template.merge(velocityContext, writer);
             // 将文件复制到上报路径中
-            super.copyUploadFile(writer, file, FileTypeEnum.E26.name(), null, systemDate, stationCode);
+            super.copyUploadFile(writer, file, FileTypeEnum.E26.name(), null, date, stationCode);
           }
         } else {
           log.error(stationCode + "可用短期上报模板不存在!");
@@ -300,7 +309,7 @@ public class E63UploadFileService extends BaseUploadFileService {
             writer = new StringWriter();
             template.merge(velocityContext, writer);
 
-            super.copyUploadFile(writer, file, FileTypeEnum.E2.name(), null, systemDate, stationCode);
+            super.copyUploadFile(writer, file, FileTypeEnum.E2.name(), null, date, stationCode);
           }
         } else {
           log.error(stationCode + "超短期上报模板不存在!");
@@ -382,7 +391,7 @@ public class E63UploadFileService extends BaseUploadFileService {
             velocityContext.put("uploadTime", DateFormatUtils.format(startTime - 15 * 60 * 1000, "yyyy-MM-dd_HH:mm"));
             writer = new StringWriter();
             template.merge(velocityContext, writer);
-            super.copyUploadFile(writer, file, FileTypeEnum.E27.name(), null, systemDate, stationCode);
+            super.copyUploadFile(writer, file, FileTypeEnum.E27.name(), null, date, stationCode);
           }
         } else {
           log.error(stationCode + "可用超短期上报模板不存在!");
@@ -424,13 +433,13 @@ public class E63UploadFileService extends BaseUploadFileService {
           template = this.velocityEngine.getTemplate(this.vmsPath + "/QXZ.vm");
           fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E6", endTime);
           if (getFileName(fileName, "E6", stationCode)) {
-            generateQxzFile(fileName, template, electricFieldInfo, systemDate, startTime, endTime);
+            generateQxzFile(fileName, template, electricFieldInfo, date, startTime, endTime);
           }
         } else {
           template = this.velocityEngine.getTemplate(this.vmsPath + "/CFT.vm");
           fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E7", endTime);
           if (getFileName(fileName, "E7", stationCode)) {
-            generateCftFile(fileName, template, electricFieldInfo, systemDate, startTime, endTime);
+            generateCftFile(fileName, template, electricFieldInfo, date, startTime, endTime);
           }
         }
       } catch (Exception e) {
@@ -448,8 +457,10 @@ public class E63UploadFileService extends BaseUploadFileService {
     // 将气象站信息过滤出上报
     List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
     if (!weatherStationInfos.isEmpty()) {
-      String uploadWeatherStationNo = weatherStationInfos.get(0).getEquipmentNo();
-      Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + uploadWeatherStationNo);
+      String qxzId = String.valueOf(weatherStationInfos.get(0).getId());
+      // 设备编号
+      String equipmentNo = String.valueOf(weatherStationInfos.get(0).getEquipmentNo());
+      Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + qxzId);
       // 数据格式化
       DecimalFormat df = new DecimalFormat("0.00");
       BigDecimal globalR = new BigDecimal(0);
@@ -462,42 +473,58 @@ public class E63UploadFileService extends BaseUploadFileService {
       BigDecimal rh = new BigDecimal(0);
       BigDecimal cellT = new BigDecimal(0);
 
-      boolean isRedisData = false;
+      boolean isUseRedis = false;
       if (!qxzMap.isEmpty()) {
         String time = qxzMap.get("time");
         if (StrUtil.isNotBlank(time)) {
           if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
-            isRedisData = true;
+            // 从缓存里赋值
+            globalR = qxzMap.get("globalR") == null ? qxzRandomCreate("globalR") : new BigDecimal(qxzMap.get("globalR"));
+            directR = qxzMap.get("directR") == null ? qxzRandomCreate("directR") : new BigDecimal(qxzMap.get("directR"));
+            diffuseR = qxzMap.get("diffuseR") == null ? globalR.subtract(directR) : new BigDecimal(qxzMap.get("diffuseR"));
+            airT = qxzMap.get("airT") == null ? qxzRandomCreate("airT") : new BigDecimal(qxzMap.get("airT"));
+            p = qxzMap.get("p") == null ? qxzRandomCreate("p") : new BigDecimal(qxzMap.get("p"));
+            rh = qxzMap.get("rh") == null ? qxzRandomCreate("rh") : new BigDecimal(qxzMap.get("rh"));
+            cellT = qxzMap.get("cellT") == null ? qxzRandomCreate("cellT") : new BigDecimal(qxzMap.get("cellT"));
+            ws = qxzMap.get("ws") == null ? qxzRandomCreate("ws") : new BigDecimal(qxzMap.get("ws"));
+            wd = qxzMap.get("wd") == null ? qxzRandomCreate("wd") : new BigDecimal(qxzMap.get("wd"));
+            isUseRedis = true;
+            log.info(electricFieldInfo.getStationCode() + "生成气象站数据从redis获取:" + qxzMap.toString());
           }
         }
       }
 
-      if (isRedisData) {
-        // 从缓存里赋值
-        globalR = qxzMap.get("globalR") == null ? qxzRandomCreate("globalR") : new BigDecimal(qxzMap.get("globalR"));
-        directR = qxzMap.get("directR") == null ? qxzRandomCreate("directR") : new BigDecimal(qxzMap.get("directR"));
-        diffuseR = qxzMap.get("diffuseR") == null ? globalR.subtract(directR) : new BigDecimal(qxzMap.get("diffuseR"));
-        airT = qxzMap.get("airT") == null ? qxzRandomCreate("airT") : new BigDecimal(qxzMap.get("airT"));
-        p = qxzMap.get("p") == null ? qxzRandomCreate("p") : new BigDecimal(qxzMap.get("p"));
-        rh = qxzMap.get("rh") == null ? qxzRandomCreate("rh") : new BigDecimal(qxzMap.get("rh"));
-        cellT = qxzMap.get("cellT") == null ? qxzRandomCreate("cellT") : new BigDecimal(qxzMap.get("cellT"));
-        ws = qxzMap.get("ws") == null ? qxzRandomCreate("ws") : new BigDecimal(qxzMap.get("ws"));
-        wd = qxzMap.get("wd") == null ? qxzRandomCreate("wd") : new BigDecimal(qxzMap.get("wd"));
-        log.info(electricFieldInfo.getStationCode() + "生成气象站数据从redis获取:" + qxzMap.toString());
-      } else {
-        // 总辐射产生500-1000随机数
-        globalR = qxzRandomCreate("globalR");
-        // 直辐射产生400-500随机数
-        directR = qxzRandomCreate("directR");
-        // 散辐射 = 总 - 直
-        diffuseR = globalR.subtract(directR);
-        airT = qxzRandomCreate("airT");
-        p = qxzRandomCreate("p");
-        rh = qxzRandomCreate("rh");
-        cellT = qxzRandomCreate("cellT");
-        ws = qxzRandomCreate("ws");
-        wd = qxzRandomCreate("wd");
-        log.info(electricFieldInfo.getStationCode() + "生成气象站数据用随机数");
+      if (!isUseRedis) {
+        List<WeatherStationStatusData> weatherStationStatusDataList = weatherStationStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime), equipmentNo);
+        if (weatherStationStatusDataList.isEmpty()){
+          // 总辐射产生500-1000随机数
+          globalR = qxzRandomCreate("globalR");
+          // 直辐射产生400-500随机数
+          directR = qxzRandomCreate("directR");
+          // 散辐射 = 总 - 直
+          diffuseR = globalR.subtract(directR);
+          airT = qxzRandomCreate("airT");
+          p = qxzRandomCreate("p");
+          rh = qxzRandomCreate("rh");
+          cellT = qxzRandomCreate("cellT");
+          ws = qxzRandomCreate("ws");
+          wd = qxzRandomCreate("wd");
+          log.info(electricFieldInfo.getStationCode() + "生成气象站数据用随机数");
+        }
+        else{
+          weatherStationStatusDataList.stream().sorted(Comparator.comparing(WeatherStationStatusData::getTime).reversed()).collect(Collectors.toList());
+          WeatherStationStatusData weatherStationStatusData = weatherStationStatusDataList.get(0);
+          globalR = weatherStationStatusData.getGlobalR();
+          directR = weatherStationStatusData.getDirectR();
+          diffuseR = globalR.subtract(directR);
+          airT = weatherStationStatusData.getAirT();
+          p = weatherStationStatusData.getP();
+          rh = weatherStationStatusData.getRh();
+          cellT = weatherStationStatusData.getCellT();
+          ws = weatherStationStatusData.getWs();
+          wd = weatherStationStatusData.getWd();
+          log.info(electricFieldInfo.getStationCode() + "生成气象站数据从数据表获取");
+        }
       }
       // 创建上报文件
       File file = super.createTempFile(fileName);
@@ -544,8 +571,9 @@ public class E63UploadFileService extends BaseUploadFileService {
     // 将测风塔信息过滤出上报的塔
     List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
     if (!filterWindTowerInfoList.isEmpty()) {
-      String uploadWindtowerStationNo = filterWindTowerInfoList.get(0).getEquipmentNo();
-      Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + uploadWindtowerStationNo);
+      String cftId = String.valueOf(filterWindTowerInfoList.get(0).getId());
+      String equipmentNo = String.valueOf(filterWindTowerInfoList.get(0).getEquipmentNo());
+      Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + cftId);
       // 数据格式化
       DecimalFormat df = new DecimalFormat("0.00");
       BigDecimal ws10 = new BigDecimal(0);
@@ -570,135 +598,203 @@ public class E63UploadFileService extends BaseUploadFileService {
       BigDecimal p8 = new BigDecimal(0);
       BigDecimal rh8 = new BigDecimal(0);
 
-      boolean isRedisData = false;
+      boolean isUseRedis = false;
       if (!cftMap.isEmpty()) {
         String time = cftMap.get("time");
         if (StrUtil.isNotBlank(time)) {
           if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
-            isRedisData = true;
+            // 从缓存里赋值
+            ws10 = cftMap.get("wsInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst10"));
+            wd10 = cftMap.get("wdInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst10"));
+            ws30 = cftMap.get("wsInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst30"));
+            wd30 = cftMap.get("wdInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst30"));
+            ws50 = cftMap.get("wsInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst50"));
+            wd50 = cftMap.get("wdInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst50"));
+            ws60 = cftMap.get("wsInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst60"));
+            wd60 = cftMap.get("wdInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst60"));
+            ws70 = cftMap.get("wsInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst70"));
+            wd70 = cftMap.get("wdInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst70"));
+            ws80 = cftMap.get("wsInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst80"));
+            wd80 = cftMap.get("wdInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst80"));
+            ws90 = cftMap.get("wsInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst90"));
+            wd90 = cftMap.get("wdInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst90"));
+            ws100 = cftMap.get("wsInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst100"));
+            wd100 = cftMap.get("wdInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst100"));
+            wsHubHeight = cftMap.get("wsInstHubHeight") == null ? cftRandomCreate("wsInstHubHeight") : new BigDecimal(cftMap.get("wsInstHubHeight"));
+            wdHubHeight = cftMap.get("wdInstHubHeight") == null ? cftRandomCreate("wdInstHubHeight") : new BigDecimal(cftMap.get("wdInstHubHeight"));
+            t8 = cftMap.get("tInst") == null ? cftRandomCreate("tInst") : new BigDecimal(cftMap.get("tInst"));
+            p8 = cftMap.get("paInst") == null ? cftRandomCreate("paInst") : new BigDecimal(cftMap.get("paInst"));
+            rh8 = cftMap.get("rhInst") == null ? cftRandomCreate("rhInst") : new BigDecimal(cftMap.get("rhInst"));
+            isUseRedis = true;
+            log.info(electricFieldInfo.getStationCode() + "生成测风塔数据从redis获取:" + cftMap.toString());
           }
         }
       }
-      if (isRedisData) {
-        // 从缓存里赋值
-        ws10 = cftMap.get("wsInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst10"));
-        wd10 = cftMap.get("wdInst10") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst10"));
-        ws30 = cftMap.get("wsInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst30"));
-        wd30 = cftMap.get("wdInst30") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst30"));
-        ws50 = cftMap.get("wsInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst50"));
-        wd50 = cftMap.get("wdInst50") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst50"));
-        ws60 = cftMap.get("wsInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst60"));
-        wd60 = cftMap.get("wdInst60") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst60"));
-        ws70 = cftMap.get("wsInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst70"));
-        wd70 = cftMap.get("wdInst70") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst70"));
-        ws80 = cftMap.get("wsInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst80"));
-        wd80 = cftMap.get("wdInst80") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst80"));
-        ws90 = cftMap.get("wsInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst90"));
-        wd90 = cftMap.get("wdInst90") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst90"));
-        ws100 = cftMap.get("wsInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wsInst100"));
-        wd100 = cftMap.get("wdInst100") == null ? new BigDecimal("-99") : new BigDecimal(cftMap.get("wdInst100"));
-        wsHubHeight = cftMap.get("wsInstHubHeight") == null ? cftRandomCreate("wsInstHubHeight") : new BigDecimal(cftMap.get("wsInstHubHeight"));
-        wdHubHeight = cftMap.get("wdInstHubHeight") == null ? cftRandomCreate("wdInstHubHeight") : new BigDecimal(cftMap.get("wdInstHubHeight"));
-        t8 = cftMap.get("tInst") == null ? cftRandomCreate("tInst") : new BigDecimal(cftMap.get("tInst"));
-        p8 = cftMap.get("paInst") == null ? cftRandomCreate("paInst") : new BigDecimal(cftMap.get("paInst"));
-        rh8 = cftMap.get("rhInst") == null ? cftRandomCreate("rhInst") : new BigDecimal(cftMap.get("rhInst"));
-        log.info(electricFieldInfo.getStationCode() + "生成测风塔数据从redis获取:" + cftMap.toString());
-      } else {
-        // 没有测风塔数据用nwp数据补
-        Long nwpTime;
-        try {
-          nwpTime = DateMomentUtil.getMomentTime(date.getTime(), 1, 15 * 60 * 1000L);
-        } catch (Exception e) {
-          log.error("获取nwp时刻步长错误", e);
-          nwpTime = DateMomentUtil.getDayStartTime(date.getTime());
+      if (!isUseRedis) {
+        List<WindTowerStatusData> windTowerStatusDataList = windTowerStatusDataRepository.findByEquipmentNoAndTimeBetween(equipmentNo, new Date(startTime), new Date(endTime));
+        if (windTowerStatusDataList.isEmpty()){
+          // 没有测风塔数据用nwp数据补
+          Long nwpTime;
+          try {
+            nwpTime = DateMomentUtil.getMomentTime(endTime, 1, 15 * 60 * 1000L);
+          } catch (Exception e) {
+            log.error("获取nwp时刻步长错误", e);
+            nwpTime = DateMomentUtil.getDayStartTime(new Date().getTime());
+          }
+          List<Nwp> nwpList = nwpRepository.findByPreTimeBetween(nwpTime, nwpTime);
+
+          if (nwpList.size() > 0) {
+            Nwp nwpData = nwpList.get(0);
+            ws10 = nwpData.getWs10();
+            ws10 = ws10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd10 = nwpData.getWd10();
+            wd10 = wd10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws30 = nwpData.getWs30();
+            ws30 = ws30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd30 = nwpData.getWd30();
+            wd30 = wd30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws50 = nwpData.getWs50();
+            ws50 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd50 = nwpData.getWd50();
+            wd50 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws60 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd60 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws70 = nwpData.getWs70();
+            ws70 = ws70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd70 = nwpData.getWd70();
+            wd70 = wd70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws80 = nwpData.getWs80();
+            ws80 = ws80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd80 = nwpData.getWd80();
+            wd80 = wd80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws90 = nwpData.getWs90();
+            ws90 = ws90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd90 = nwpData.getWd90();
+            wd90 = wd90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            ws100 = nwpData.getWs100();
+            ws100 = ws100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wd100 = nwpData.getWd100();
+            wd100 = wd100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wsHubHeight = nwpData.getWs170();
+            wsHubHeight = wsHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            wdHubHeight = nwpData.getWd170();
+            wdHubHeight = wdHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            rh8 = nwpData.getRh();
+            rh8 = rh8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            t8 = nwpData.getT();
+            t8 = t8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            p8 = nwpData.getPressure();
+            p8 = p8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
+            log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用nwp+随机数");
+          } else {
+            // 10米风速产生1-5随机数
+            ws10 = cftRandomCreate("wsInst10");
+            // 10米风向产生40-60随机数
+            wd10 = cftRandomCreate("wdInst10");
+            // 30米风速产生6-10随机数
+            ws30 = cftRandomCreate("wsInst30");
+            // 30米风向产生70-90随机数
+            wd30 = cftRandomCreate("wdInst30");
+            // 50米风速产生16-20随机数
+            ws50 = cftRandomCreate("wsInst50");
+            // 50米风向产生130-150随机数
+            wd50 = cftRandomCreate("wdInst50");
+            // 60米风速产生16-20随机数
+            ws60 = cftRandomCreate("wsInst60");
+            // 60米风向产生130-150随机数
+            wd60 = cftRandomCreate("wdInst60");
+            // 70米风速产生31-35随机数
+            ws70 = cftRandomCreate("wsInst70");
+            // 70米风向产生220-240随机数
+            wd70 = cftRandomCreate("wdInst70");
+            // 80米风速产生35-40随机数
+            ws80 = cftRandomCreate("wsInst80");
+            // 80米风向产生240-250随机数
+            wd80 = cftRandomCreate("wdInst80");
+            // 90米风速产生45-50随机数
+            ws90 = cftRandomCreate("wsInst90");
+            // 90米风向产生260-270随机数
+            wd90 = cftRandomCreate("wdInst90");
+            // 100米风速产生60-70随机数
+            ws100 = cftRandomCreate("wsInst100");
+            // 100米风向产生280-290随机数
+            wd100 = cftRandomCreate("wdInst100");
+            wsHubHeight = cftRandomCreate("wsInstHubHeight");
+            wdHubHeight = cftRandomCreate("wdInstHubHeight");
+            // 湿度产生50-60随机数
+            rh8 = cftRandomCreate("rhInst");
+            // 温度产生20-35随机数
+            t8 = cftRandomCreate("tInst");
+            // 气压产生75-90随机数
+            p8 = cftRandomCreate("paInst");
+            log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用随机数");
+          }
         }
-        List<Nwp> nwpList = nwpRepository.findByPreTimeBetween(nwpTime, nwpTime);
-
-        if (nwpList.size() > 0) {
-          Nwp nwpData = nwpList.get(0);
-          ws10 = nwpData.getWs10();
-          ws10 = ws10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd10 = nwpData.getWd10();
-          wd10 = wd10.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws30 = nwpData.getWs30();
-          ws30 = ws30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd30 = nwpData.getWd30();
-          wd30 = wd30.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws50 = nwpData.getWs50();
-          ws50 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd50 = nwpData.getWd50();
-          wd50 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws60 = ws50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd60 = wd50.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws70 = nwpData.getWs70();
-          ws70 = ws70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd70 = nwpData.getWd70();
-          wd70 = wd70.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws80 = nwpData.getWs80();
-          ws80 = ws80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd80 = nwpData.getWd80();
-          wd80 = wd80.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws90 = nwpData.getWs90();
-          ws90 = ws90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd90 = nwpData.getWd90();
-          wd90 = wd90.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          ws100 = nwpData.getWs100();
-          ws100 = ws100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wd100 = nwpData.getWd100();
-          wd100 = wd100.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wsHubHeight = nwpData.getWs170();
-          wsHubHeight = wsHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          wdHubHeight = nwpData.getWd170();
-          wdHubHeight = wdHubHeight.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          rh8 = nwpData.getRh();
-          rh8 = rh8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          t8 = nwpData.getT();
-          t8 = t8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          p8 = nwpData.getPressure();
-          p8 = p8.add(new BigDecimal(df.format(Math.random() * 1 + 0.01))).setScale(2, BigDecimal.ROUND_HALF_UP);
-          log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用nwp+随机数");
-        } else {
-          // 10米风速产生1-5随机数
-          ws10 = cftRandomCreate("wsInst10");
-          // 10米风向产生40-60随机数
-          wd10 = cftRandomCreate("wdInst10");
-          // 30米风速产生6-10随机数
-          ws30 = cftRandomCreate("wsInst30");
-          // 30米风向产生70-90随机数
-          wd30 = cftRandomCreate("wdInst30");
-          // 50米风速产生16-20随机数
-          ws50 = cftRandomCreate("wsInst50");
-          // 50米风向产生130-150随机数
-          wd50 = cftRandomCreate("wdInst50");
-          // 60米风速产生16-20随机数
-          ws60 = cftRandomCreate("wsInst60");
-          // 60米风向产生130-150随机数
-          wd60 = cftRandomCreate("wdInst60");
-          // 70米风速产生31-35随机数
-          ws70 = cftRandomCreate("wsInst70");
-          // 70米风向产生220-240随机数
-          wd70 = cftRandomCreate("wdInst70");
-          // 80米风速产生35-40随机数
-          ws80 = cftRandomCreate("wsInst80");
-          // 80米风向产生240-250随机数
-          wd80 = cftRandomCreate("wdInst80");
-          // 90米风速产生45-50随机数
-          ws90 = cftRandomCreate("wsInst90");
-          // 90米风向产生260-270随机数
-          wd90 = cftRandomCreate("wdInst90");
-          // 100米风速产生60-70随机数
-          ws100 = cftRandomCreate("wsInst100");
-          // 100米风向产生280-290随机数
-          wd100 = cftRandomCreate("wdInst100");
-          wsHubHeight = cftRandomCreate("wsInstHubHeight");
-          wdHubHeight = cftRandomCreate("wdInstHubHeight");
-          // 湿度产生50-60随机数
-          rh8 = cftRandomCreate("rhInst");
-          // 温度产生20-35随机数
-          t8 = cftRandomCreate("tInst");
-          // 气压产生75-90随机数
-          p8 = cftRandomCreate("paInst");
-          log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用随机数");
+        else{
+          windTowerStatusDataList.stream().sorted(Comparator.comparing(WindTowerStatusData::getTime).reversed()).collect(Collectors.toList());
+          WindTowerStatusData windTowerStatusData = windTowerStatusDataList.get(0);
+          // 10米风速
+          if (windTowerStatusData.getWsInst10()!=null)
+            ws10 = windTowerStatusData.getWsInst10();
+          // 10米风向
+          if (windTowerStatusData.getWdInst10()!=null)
+            wd10 = windTowerStatusData.getWdInst10();
+          // 30米风速
+          if (windTowerStatusData.getWdInst30()!=null)
+            ws30 = windTowerStatusData.getWsInst30();
+          // 30米风向
+          if (windTowerStatusData.getWdInst30()!=null)
+            wd30 = windTowerStatusData.getWdInst30();
+          // 50米风速
+          if (windTowerStatusData.getWdInst50()!=null)
+            ws50 = windTowerStatusData.getWsInst50();
+          // 50米风向
+          if (windTowerStatusData.getWdInst50()!=null)
+            wd50 = windTowerStatusData.getWdInst50();
+          // 60米风速
+          if (windTowerStatusData.getWdInst60()!=null)
+            ws60 = windTowerStatusData.getWsInst60();
+          // 60米风向
+          if (windTowerStatusData.getWdInst60()!=null)
+            wd60 = windTowerStatusData.getWdInst60();
+          // 70米风速
+          if (windTowerStatusData.getWdInst70()!=null)
+            ws70 = windTowerStatusData.getWsInst70();
+          // 70米风向
+          if (windTowerStatusData.getWdInst70()!=null)
+            wd70 = windTowerStatusData.getWdInst70();
+          // 80米风速
+          if (windTowerStatusData.getWdInst80()!=null)
+            ws80 = windTowerStatusData.getWsInst80();
+          // 80米风向
+          if (windTowerStatusData.getWdInst80()!=null)
+            wd80 = windTowerStatusData.getWdInst80();
+          // 90米风速
+          if (windTowerStatusData.getWdInst90()!=null)
+            ws90 = windTowerStatusData.getWsInst90();
+          // 90米风向
+          if (windTowerStatusData.getWdInst90()!=null)
+            wd90 = windTowerStatusData.getWdInst90();
+          // 100米风速
+          if (windTowerStatusData.getWdInst100()!=null)
+            ws100 = windTowerStatusData.getWsInst100();
+          // 100米风向
+          if (windTowerStatusData.getWdInst100()!=null)
+            wd100 = windTowerStatusData.getWdInst100();
+          if (windTowerStatusData.getWsInstHubHeight()!=null)
+            wsHubHeight = windTowerStatusData.getWsInstHubHeight();
+          if (windTowerStatusData.getWdInstHubHeight()!=null)
+            wdHubHeight = windTowerStatusData.getWdInstHubHeight();
+          // 湿度产生
+          if (windTowerStatusData.getRhInst()!=null)
+            rh8 = windTowerStatusData.getRhInst();
+          // 温度产生
+          if (windTowerStatusData.getTInst()!=null)
+            t8 = windTowerStatusData.getTInst();
+          // 气压产生
+          if (windTowerStatusData.getPaInst()!=null)
+            p8 = windTowerStatusData.getPaInst();
+          log.info(electricFieldInfo.getStationCode() + "生成测风塔数据用数据表");
         }
       }
       // 创建上报文件
@@ -803,8 +899,9 @@ public class E63UploadFileService extends BaseUploadFileService {
         map.put("elName",electricFieldInfo.getName());
         map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
 
-        String windTurbineEquipmentNo = windTurbineInfo.getEquipmentNo();
-        Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + windTurbineEquipmentNo);
+        String fjId = String.valueOf(windTurbineInfo.getId());
+        String equipmentNo = String.valueOf(windTurbineInfo.getEquipmentNo());
+        Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + fjId);
         DecimalFormat df = new DecimalFormat("0.00");
 
         // 状态
@@ -833,7 +930,7 @@ public class E63UploadFileService extends BaseUploadFileService {
         BigDecimal pitchAngle = new BigDecimal("0");
         // 累积发电量
         BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
-
+        boolean isUseRedis = false;
         if (!fjMap.isEmpty()) {
           String time = fjMap.get("time");
           if (StrUtil.isNotBlank(time)) {
@@ -877,9 +974,62 @@ public class E63UploadFileService extends BaseUploadFileService {
               if (fjMap.get("pitchAngle") != null) {
                 pitchAngle = new BigDecimal(fjMap.get("pitchAngle"));
               }
+              isUseRedis = true;
+              log.info(electricFieldInfo.getStationCode() + "生成风机数据用缓存");
+            }
+          }
+        }
+        if (!isUseRedis){
+          List<WindTurbineStatusData> windTurbineStatusDataList = windTurbineStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
+          if (!windTurbineStatusDataList.isEmpty()){
+            windTurbineStatusDataList.stream().sorted(Comparator.comparing(WindTurbineStatusData::getTime).reversed()).collect(Collectors.toList());
+            WindTurbineStatusData windTurbineStatusData = windTurbineStatusDataList.get(0);
+            if (windTurbineStatusData.getStatus() != null) {
+              status = String.valueOf(windTurbineStatusData.getStatus());
+            }
+            if (windTurbineStatusData.getActivePower() != null) {
+              activePower = windTurbineStatusData.getActivePower();
             }
+            if (windTurbineStatusData.getReactivePower() != null) {
+              reactivePower = windTurbineStatusData.getReactivePower();
+            }
+            if (windTurbineStatusData.getPowerFactor() != null) {
+              powerFactor = windTurbineStatusData.getPowerFactor();
+            }
+            if (windTurbineStatusData.getVoltage() != null) {
+              voltage = windTurbineStatusData.getVoltage();
+            }
+            if (windTurbineStatusData.getElectricalCurrent() != null) {
+              electricalCurrent = windTurbineStatusData.getElectricalCurrent();
+            }
+            if (windTurbineStatusData.getDayElectricQuantity() != null) {
+              dayElectricQuantity = windTurbineStatusData.getDayElectricQuantity();
+            }
+            if (windTurbineStatusData.getCumulativeGeneratedEnergy() != null) {
+              cumulativeGeneratedEnergy = windTurbineStatusData.getCumulativeGeneratedEnergy();
+            }
+            if (windTurbineStatusData.getWindWheelRatedSpeed() != null) {
+              windWheelRatedSpeed = windTurbineStatusData.getWindWheelRatedSpeed();
+            }
+            if (windTurbineStatusData.getWs() != null) {
+              ws = windTurbineStatusData.getWs();
+            }
+            if (windTurbineStatusData.getWd() != null) {
+              wd = windTurbineStatusData.getWd();
+            }
+            if (windTurbineStatusData.getT() != null) {
+              t = windTurbineStatusData.getT();
+            }
+            if (windTurbineStatusData.getPitchAngle() != null) {
+              pitchAngle = windTurbineStatusData.getPitchAngle();
+            }
+            log.info(electricFieldInfo.getStationCode() + "生成风机数据用数据表");
+          }
+          else{
+            log.info(electricFieldInfo.getStationCode() + "生成风机数据缓存和数据表都没有值,使用默认0");
           }
         }
+
         map.put("ActivePower", div(activePower, new BigDecimal("1000"), 2).toString());
         map.put("ReActivePower", div(reactivePower, new BigDecimal("1000"), 2).toString());
         map.put("RotationlSpeed", df.format(windWheelRatedSpeed));
@@ -943,8 +1093,9 @@ public class E63UploadFileService extends BaseUploadFileService {
         map.put("sample", inverterInfo.getSample() ? "1" : "0");
         //是否组串
         map.put("IsString", inverterInfo.getGroupSeries() ? "1" : "0");
-        String inverterEquipmentNo = inverterInfo.getEquipmentNo();
-        Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + inverterEquipmentNo);
+        String nbqId = String.valueOf(inverterInfo.getId());
+        String equipmentNo = String.valueOf(inverterInfo.getEquipmentNo());
+        Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + nbqId);
         DecimalFormat df = new DecimalFormat("0.00");
         // 状态
         String status = "1";
@@ -962,6 +1113,7 @@ public class E63UploadFileService extends BaseUploadFileService {
         BigDecimal dayElectricQuantity = new BigDecimal("0");
         // 累积发电量
         BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
+        boolean isUseRedis = false;
         if (!nbqMap.isEmpty()) {
           String time = nbqMap.get("time");
           if (StrUtil.isNotBlank(time)) {
@@ -990,7 +1142,52 @@ public class E63UploadFileService extends BaseUploadFileService {
               if (nbqMap.get("cumulativeGeneratedEnergy") != null) {
                 cumulativeGeneratedEnergy = new BigDecimal(nbqMap.get("cumulativeGeneratedEnergy"));
               }
+              isUseRedis = true;
+              log.info(electricFieldInfo.getStationCode() + "生成逆变器数据用缓存");
+            }
+          }
+        }
+
+        if (!isUseRedis){
+          List<InverterStatusData> inverterStatusDataList = inverterStatusDataRepository.findByTimeBetweenAndEquipmentNo(new Date(startTime), new Date(endTime),equipmentNo);
+          if (!inverterStatusDataList.isEmpty()){
+            inverterStatusDataList.stream().sorted(Comparator.comparing(InverterStatusData::getTime).reversed()).collect(Collectors.toList());
+            InverterStatusData inverterStatusData = inverterStatusDataList.get(0);
+            if (inverterStatusData.getStatus() != null) {
+              status = String.valueOf(inverterStatusData.getStatus());
+            }
+            // 有功
+            if (inverterStatusData.getActivePower() != null) {
+              activePower = inverterStatusData.getActivePower();
+            }
+            // 无功
+            if (inverterStatusData.getReactivePower() != null) {
+              reactivePower = inverterStatusData.getReactivePower();
+            }
+            // 电压
+            if (inverterStatusData.getVoltage() != null) {
+              voltage = inverterStatusData.getVoltage();
+            }
+            // 电流
+            if (inverterStatusData.getElectricalCurrent() != null) {
+              electricalCurrent = inverterStatusData.getElectricalCurrent();
+            }
+            // 功率因数
+            if (inverterStatusData.getPowerFactor() != null) {
+              powerFactor = inverterStatusData.getPowerFactor();
+            }
+            // 日发电量
+            if (inverterStatusData.getDayElectricQuantity() != null) {
+              dayElectricQuantity = inverterStatusData.getDayElectricQuantity();
+            }
+            // 累计发电量
+            if (inverterStatusData.getCumulativeGeneratedEnergy() != null) {
+              cumulativeGeneratedEnergy = inverterStatusData.getCumulativeGeneratedEnergy();
             }
+            log.info(electricFieldInfo.getStationCode() + "生成逆变器数据用数据表");
+          }
+          else{
+            log.info(electricFieldInfo.getStationCode() + "生成逆变器数据缓存和数据表都没有值,使用默认0");
           }
         }
         map.put("status", status);
@@ -1050,23 +1247,21 @@ public class E63UploadFileService extends BaseUploadFileService {
         if (date != null) {
           systemDate = date;
         }
-        Long startTime = DateMomentUtil.getMomentTime(systemDate.getTime() - 5 * 60 * 1000, 1, 5 * 60 * 1000L);
-        Long endTime = startTime + 5 * 60 * 1000 - 1000;
+        Long endTime = DateMomentUtil.getMomentTime(systemDate.getTime(), 1, 5 * 60 * 1000L);
+        Long startTime = endTime - 4 * 60 * 1000;
         // 生成上报文件名格式
         Template template = null;
         if (electricFieldInfo.getElectricFieldTypeEnum().toString().equals("E1")) {
-          // 获取气象站模板
-          template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY.vm");
-          fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E3", endTime + 1000);
+          fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E3", endTime);
           if (getFileName(fileName, "E3", stationCode)) {
-            // 理论功率光
+            template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY.vm");
             generatePvTheroyFile(fileName, template, electricFieldInfo, date, startTime, endTime);
           }
         } else {
-          template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY_F.vm");
-          fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E85", endTime + 1000);
+          fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E85", endTime);
           if (getFileName(fileName, "E85", stationCode)) {
             // 理论功率风
+            template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY_F.vm");
             generateWpTheroyFile(fileName, template, electricFieldInfo, date, startTime, endTime);
           }
         }
@@ -1080,36 +1275,59 @@ public class E63UploadFileService extends BaseUploadFileService {
    * 生成理论功率光上报文件
    */
   private void generatePvTheroyFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
-    // powerStationStatusDataList需要从缓存获取
-    List<PowerStationStatusData> powerStationStatusDataList = new ArrayList<>();
     // 样板机变量
     float ableValueAfter = 0f;
     // 辐照仪变量
     float theoryValueAfter = 0f;
-    if (powerStationStatusDataList.size() > 0) {
-      // 实际功率按时间降序
-      powerStationStatusDataList.sort(Comparator.comparing(PowerStationStatusData::getTime).reversed());
-      // 对预测值保留2位小数显示输出
-      DecimalFormat df = new DecimalFormat("0.00");
-      // 取最后一个时间的数据
-      PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
-      ableValueAfter = Float.parseFloat(df.format(powerStationStatusData.getAbleValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getAbleValue()));
-      theoryValueAfter = Float.parseFloat(df.format(powerStationStatusData.getTheoryValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getTheoryValue()));
+    Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
+    boolean isUseRedis = false;
+    if (!powerMap.isEmpty()) {
+      String time = powerMap.get("time");
+      if (StrUtil.isNotBlank(time)) {
+        if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
+          // 对预测值保留2位小数显示输出
+          DecimalFormat df = new DecimalFormat("0.00");
+          if (powerMap.get("ableValue") != null) {
+            ableValueAfter = Float.parseFloat(powerMap.get("ableValue"));
+          }
+          if (powerMap.get("theoryValue") != null) {
+            theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
+          }
+          isUseRedis = true;
+          log.info(electricFieldInfo.getStationCode() + "生成理论功率使用缓存");
+        }
+      }
+    }
+
+    if (!isUseRedis){
+      // 从数据表获取
+      List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(new Date(startTime), new Date(endTime),electricFieldInfo.getStationCode());
+      if (!powerStationStatusDataList.isEmpty()) {
+        powerStationStatusDataList.stream().sorted(Comparator.comparing(PowerStationStatusData::getTime).reversed()).collect(Collectors.toList());
+        PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
+        if (powerStationStatusData.getAbleValue()!=null)
+          ableValueAfter = powerStationStatusData.getAbleValue().floatValue();
+        if (powerStationStatusData.getTheoryValue()!=null)
+          theoryValueAfter = powerStationStatusData.getTheoryValue().floatValue();
+        log.info(electricFieldInfo.getStationCode() + "生成理论功率使用数据表");
+      }
     }
+
+    DecimalFormat df = new DecimalFormat("0.00");
     // 创建上报文件
     File file = super.createTempFile(fileName);
     // 根据模板生成文件内容
     VelocityContext velocityContext = new VelocityContext();
     // 样板机
-    velocityContext.put("ableValueAfter", ableValueAfter);
+    velocityContext.put("ableValueAfter", df.format(ableValueAfter));
     // 辐照仪
-    velocityContext.put("theoryValueAfter", theoryValueAfter);
+    velocityContext.put("theoryValueAfter", df.format(theoryValueAfter));
     // 场站标识
     velocityContext.put("sign", electricFieldInfo.getSign());
     // 系统当前日期
-    velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
+    velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
     // 上报数据开始日期
-    velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000 * 60 * 5 + 1000, "yyyy-MM-dd_HH:mm"));
+    velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm"));
     StringWriter writer = new StringWriter();
     template.merge(velocityContext, writer);
     super.copyUploadFile(writer, file, FileTypeEnum.E3.name(), null, date, electricFieldInfo.getStationCode());
@@ -1119,8 +1337,6 @@ public class E63UploadFileService extends BaseUploadFileService {
    * 生成理论功率风上报文件
    */
   private void generateWpTheroyFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
-    // powerStationStatusDataList需要从缓存获取
-    List<PowerStationStatusData> powerStationStatusDataList = new ArrayList<>();
     // 可用
     float ableValueAfter = 0f;
     // 理论
@@ -1129,37 +1345,66 @@ public class E63UploadFileService extends BaseUploadFileService {
     float referencePowerBySampleAfter = 0f;
     //测风
     float referencePowerByMeasuringAfter = 0f;
+    Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
+    boolean isUseRedis = false;
+    if (!powerMap.isEmpty()) {
+      String time = powerMap.get("time");
+      if (StrUtil.isNotBlank(time)) {
+        if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
+          if (powerMap.get("ableValue") != null) {
+            ableValueAfter = Float.parseFloat(powerMap.get("ableValue"));
+          }
+          if (powerMap.get("theoryValue") != null) {
+            theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
+          }
+          if (powerMap.get("referencePowerBySample") != null) {
+            referencePowerBySampleAfter = Float.parseFloat(powerMap.get("referencePowerBySample"));
+          }
+          if (powerMap.get("referencePowerByMeasuring") != null) {
+            referencePowerByMeasuringAfter = Float.parseFloat(powerMap.get("referencePowerByMeasuring"));
+          }
+          isUseRedis = true;
+          log.info(electricFieldInfo.getStationCode() + "生成理论功率使用缓存");
+        }
+      }
+    }
 
-    if (powerStationStatusDataList.size() > 0) {
-      // 实际功率按时间降序
-      powerStationStatusDataList.sort(Comparator.comparing(PowerStationStatusData::getTime).reversed());
-      // 对预测值保留2位小数显示输出
-      DecimalFormat df = new DecimalFormat("0.00");
-      // 取最后一个时间的数据
-      PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
-      ableValueAfter = Float.parseFloat(df.format(powerStationStatusData.getAbleValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getAbleValue()));
-      theoryValueAfter = Float.parseFloat(df.format(powerStationStatusData.getTheoryValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getTheoryValue()));
-      referencePowerBySampleAfter = Float.parseFloat(df.format(powerStationStatusData.getReferencePowerBySample().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getReferencePowerBySample()));
-      referencePowerByMeasuringAfter = Float.parseFloat(df.format(powerStationStatusData.getReferencePowerByMeasuring().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getReferencePowerByMeasuring()));
+    if (!isUseRedis){
+      // 从数据表获取
+      List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(new Date(startTime), new Date(endTime),electricFieldInfo.getStationCode());
+      if (!powerStationStatusDataList.isEmpty()) {
+        powerStationStatusDataList.stream().sorted(Comparator.comparing(PowerStationStatusData::getTime).reversed()).collect(Collectors.toList());
+        PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
+        if (powerStationStatusData.getAbleValue()!=null)
+          ableValueAfter = powerStationStatusData.getAbleValue().floatValue();
+        if (powerStationStatusData.getTheoryValue()!=null)
+          theoryValueAfter = powerStationStatusData.getTheoryValue().floatValue();
+        if (powerStationStatusData.getReferencePowerBySample()!=null)
+          referencePowerBySampleAfter = powerStationStatusData.getReferencePowerBySample().floatValue();
+        if (powerStationStatusData.getReferencePowerByMeasuring()!=null)
+          referencePowerByMeasuringAfter = powerStationStatusData.getReferencePowerByMeasuring().floatValue();
+        log.info(electricFieldInfo.getStationCode() + "生成理论功率使用数据表");
+      }
     }
+    DecimalFormat df = new DecimalFormat("0.00");
     // 创建上报文件
     File file = super.createTempFile(fileName);
     // 根据模板生成文件内容
     VelocityContext velocityContext = new VelocityContext();
     // 样板机
-    velocityContext.put("ableValueAfter", ableValueAfter);
+    velocityContext.put("ableValueAfter", df.format(ableValueAfter));
     // 辐照仪
-    velocityContext.put("theoryValueAfter", theoryValueAfter);
+    velocityContext.put("theoryValueAfter", df.format(theoryValueAfter));
     // 样板机
-    velocityContext.put("referencePowerBySampleAfter", referencePowerBySampleAfter);
+    velocityContext.put("referencePowerBySampleAfter", df.format(referencePowerBySampleAfter));
     // 测风
-    velocityContext.put("referencePowerByMeasuringAfter", referencePowerByMeasuringAfter);
+    velocityContext.put("referencePowerByMeasuringAfter", df.format(referencePowerByMeasuringAfter));
     // 场站标识
     velocityContext.put("sign", electricFieldInfo.getSign());
     // 系统当前日期
-    velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
+    velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
     // 上报数据开始日期
-    velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000 * 60 * 5 + 1000, "yyyy-MM-dd_HH:mm") + ":00");
+    velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
     StringWriter writer = new StringWriter();
     template.merge(velocityContext, writer);
     super.copyUploadFile(writer, file, FileTypeEnum.E85.name(), null, date, electricFieldInfo.getStationCode());