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

1.修改实时短期,nwp页面bug,超短期数据展示问题及加入实际功率数据
2.调整client定时任务

wangtao 3 éve
szülő
commit
3ffbf96ff7

+ 6 - 0
ipfcst-client/pom.xml

@@ -73,6 +73,12 @@
             <artifactId>ganymed-ssh2</artifactId>
             <artifactId>ganymed-ssh2</artifactId>
             <version>build210</version>
             <version>build210</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <version>RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
     </dependencies>
     <dependencyManagement>
     <dependencyManagement>
         <dependencies>
         <dependencies>

+ 4 - 3
ipfcst-client/src/main/java/com/jiayue/client/job/DownloadFileJob.java

@@ -73,11 +73,12 @@ public class DownloadFileJob {
                         }
                         }
                         log.info("开始下载文件:{}。", fileCreateLog.getFileName());
                         log.info("开始下载文件:{}。", fileCreateLog.getFileName());
                         String url = properties.getProperty("v3cloud.fileDownUrl") + fileCreateLog.getId();// "https://117.78.19.70:9010/client/getFileById?id=" + fileCreateLog.getId();
                         String url = properties.getProperty("v3cloud.fileDownUrl") + fileCreateLog.getId();// "https://117.78.19.70:9010/client/getFileById?id=" + fileCreateLog.getId();
-                        long size = HttpUtil.downloadFile(url, path + File.separatorChar + fileCreateLog.getFileName());
+                        String targetPath = path + File.separatorChar +stationCode+File.separatorChar +"new"+File.separatorChar+ fileCreateLog.getFileName();
+                        long size = HttpUtil.downloadFile(url,targetPath);
                         if (size > 0) {
                         if (size > 0) {
                             isDownFileId.add(fileCreateLog.getId());
                             isDownFileId.add(fileCreateLog.getId());
-                            log.info("成功下载文件:{}", path + File.separatorChar + fileCreateLog.getFileName());
-                            filedownLoadList.add(path + File.separatorChar + fileCreateLog.getFileName());
+                            log.info("成功下载文件:{}", targetPath);
+                            filedownLoadList.add(targetPath);
                         }
                         }
                     }
                     }
                 } catch (Exception e) {
                 } catch (Exception e) {

+ 12 - 2
ipfcst-client/src/main/java/com/jiayue/client/service/SendDataService.java

@@ -1,6 +1,9 @@
 package com.jiayue.client.service;
 package com.jiayue.client.service;
 
 
+import cn.hutool.core.codec.Base64;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.core.util.ZipUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.json.JSONUtil;
 import com.jiayue.client.util.MD5Util;
 import com.jiayue.client.util.MD5Util;
@@ -11,6 +14,7 @@ import org.springframework.stereotype.Repository;
 
 
 import java.util.*;
 import java.util.*;
 
 
+
 @Repository
 @Repository
 @Slf4j
 @Slf4j
 public class SendDataService {
 public class SendDataService {
@@ -311,8 +315,13 @@ public class SendDataService {
         resultMap.put("sign", sign);
         resultMap.put("sign", sign);
 
 
         String reqStr = JSONUtil.toJsonStr(resultMap);
         String reqStr = JSONUtil.toJsonStr(resultMap);
-        log.info("回传数据给数据中心,请求报文:{}", reqStr);
-        String resp = HttpUtil.post(properties.getProperty("remote.dcUrl"), reqStr);
+        log.info("回传数据给数据中心,请求原报文:{}", reqStr);
+        log.info("回传数据给数据中心,请求地址:{}", properties.getProperty("remote.dcUrl")+"");
+        Map<String, Object> reqMap = new HashMap<>();
+        reqMap.put("reqMsg", Base64.encode(ZipUtil.gzip(reqStr, CharsetUtil.CHARSET_UTF_8.name())));
+        log.info("回传数据给数据中心,压缩加密后报文:{}", reqMap);
+        String resp = HttpUtil.get(properties.getProperty("remote.dcUrl"),reqMap);
+       // String resp = HttpUtil.post(properties.getProperty("remote.dcUrl")+"", reqStr);
         if (resp.length() > 0) {
         if (resp.length() > 0) {
             if (!"0".equals(JSONUtil.parseObj(resp).get("code"))) {
             if (!"0".equals(JSONUtil.parseObj(resp).get("code"))) {
                 new Exception("回传数据给数据中心错误:" + resp);
                 new Exception("回传数据给数据中心错误:" + resp);
@@ -320,4 +329,5 @@ public class SendDataService {
         }
         }
         log.info("回传数据给数据中心,获得响应报文:{}", resp);
         log.info("回传数据给数据中心,获得响应报文:{}", resp);
     }
     }
+
 }
 }

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

@@ -30,4 +30,6 @@ public interface PowerStationStatusDataRepository extends BaseRepository<PowerSt
 	 * @return 结果集
 	 * @return 结果集
 	 */
 	 */
 	PowerStationStatusData findByTime(Date queryTime);
 	PowerStationStatusData findByTime(Date queryTime);
+
+	List<PowerStationStatusData> findByTimeBetween(Date startTime, Date endTime);
 }
 }

+ 3 - 2
ipfcst-console/src/main/frontend/views/dataquery/forecastPowerShortHisTerm/index.vue

@@ -169,7 +169,7 @@ export default {
     handlePageChange({currentPage, pageSize}) {
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       this.currentPage = currentPage
       if (this.pageSize != pageSize) {
       if (this.pageSize != pageSize) {
-        this.changePageSize(pageSize)
+        this.currentPage =1
       }
       }
       this.pageSize = pageSize
       this.pageSize = pageSize
       this.startTime = this.queryStartTime
       this.startTime = this.queryStartTime
@@ -178,7 +178,8 @@ export default {
       this.getTable();
       this.getTable();
     },
     },
     changePageSize(pageSize) {
     changePageSize(pageSize) {
-      this.displayConfigPageSize.showCode = pageSize
+      this.currentPage =1
+      //this.displayConfigPageSize.showCode = pageSize
       this.$axios.post('displayConfig/', this.displayConfigPageSize).then((res) => {
       this.$axios.post('displayConfig/', this.displayConfigPageSize).then((res) => {
         this.displayConfigPageSize = res.data
         this.displayConfigPageSize = res.data
         // this.$message.success('PageSize设置成功' )
         // this.$message.success('PageSize设置成功' )

+ 5 - 6
ipfcst-console/src/main/frontend/views/dataquery/forecastPowerShortTerm/charts/index.vue

@@ -55,7 +55,7 @@
             textStyle: {
             textStyle: {
               fontWeight: 'normal',
               fontWeight: 'normal',
               fontSize: 16,
               fontSize: 16,
-              color: '#F1F1F3'
+              color: '#040606'
             },
             },
             left: '1%'
             left: '1%'
           },
           },
@@ -63,7 +63,7 @@
             trigger: 'axis',
             trigger: 'axis',
             axisPointer: {
             axisPointer: {
               lineStyle: {
               lineStyle: {
-                color: '#57617B'
+                color: '#040606'
               }
               }
             }
             }
           },
           },
@@ -76,8 +76,7 @@
             data: ['实时短期预测'],
             data: ['实时短期预测'],
             right: '4%',
             right: '4%',
             textStyle: {
             textStyle: {
-              fontSize: 12,
-              color: '#F1F1F3'
+              fontSize: 12
             }
             }
           },
           },
           dataZoom: [{
           dataZoom: [{
@@ -105,7 +104,7 @@
             boundaryGap: false,
             boundaryGap: false,
             axisLine: {
             axisLine: {
               lineStyle: {
               lineStyle: {
-                color: '#ffffff'
+                color: '#040606'
               }
               }
             },
             },
             data: timeaxis
             data: timeaxis
@@ -118,7 +117,7 @@
             },
             },
             axisLine: {
             axisLine: {
               lineStyle: {
               lineStyle: {
-                color: '#ffffff'
+                color: '#040606'
               }
               }
             },
             },
             axisLabel: {
             axisLabel: {

+ 3 - 3
ipfcst-console/src/main/frontend/views/dataquery/forecastPowerShortTerm/index.vue

@@ -203,10 +203,10 @@ export default {
       this.pageSize = pageSize
       this.pageSize = pageSize
       this.startTime = this.queryStartTime
       this.startTime = this.queryStartTime
       this.endTime = this.queryEndTime
       this.endTime = this.queryEndTime
-      this.loading = true
-      this.getTable();
+      this.getTable()
     },
     },
     changePageSize(pageSize) {
     changePageSize(pageSize) {
+      this.currentPage = 1
       this.displayConfigPageSize.showCode = pageSize
       this.displayConfigPageSize.showCode = pageSize
       this.$axios.post('displayConfig/', this.displayConfigPageSize).then((res) => {
       this.$axios.post('displayConfig/', this.displayConfigPageSize).then((res) => {
         this.displayConfigPageSize = res.data
         this.displayConfigPageSize = res.data
@@ -284,7 +284,7 @@ export default {
         this.showToolBar = true
         this.showToolBar = true
       }
       }
 
 
-    },
+    }
   }
   }
 }
 }
 </script>
 </script>

+ 6 - 3
ipfcst-console/src/main/frontend/views/dataquery/forecastPowerUltraShortTerm16/index.vue

@@ -50,7 +50,7 @@
               :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)">
               :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)">
               <vxe-table-column field="times" title="预测时间" :formatter="dateFormat" width="180" sortable
               <vxe-table-column field="times" title="预测时间" :formatter="dateFormat" width="180" sortable
                                 min-width="150"></vxe-table-column>
                                 min-width="150"></vxe-table-column>
-              <!--              <vxe-table-column field="realValue" title="实际功率" min-width="60"></vxe-table-column>-->
+                         <vxe-table-column field="realValue" title="实际功率" min-width="60"></vxe-table-column>
               <vxe-table-column field="value1" title="第1个时刻" min-width="60"></vxe-table-column>
               <vxe-table-column field="value1" title="第1个时刻" min-width="60"></vxe-table-column>
               <vxe-table-column field="value2" title="第2个时刻" min-width="60"></vxe-table-column>
               <vxe-table-column field="value2" title="第2个时刻" min-width="60"></vxe-table-column>
               <vxe-table-column field="value3" title="第3个时刻" min-width="60"></vxe-table-column>
               <vxe-table-column field="value3" title="第3个时刻" min-width="60"></vxe-table-column>
@@ -147,10 +147,10 @@ export default {
       this.$axios.get('/findByForecastRealTimeUltraShortTerm16/' + startTime + '/' + stationCode).then((res) => {
       this.$axios.get('/findByForecastRealTimeUltraShortTerm16/' + startTime + '/' + stationCode).then((res) => {
         const value = res.data.value
         const value = res.data.value
         this.tableData = []
         this.tableData = []
-        for (let i = 1; i < res.data.value.length; i++) {
+        for (let i = 1; i < res.data.realDatas.length; i++) {
           const temp = {}
           const temp = {}
           temp.times = res.data.times[i]
           temp.times = res.data.times[i]
-          //temp.realValue = res.data.realDatas[i]
+          temp.realValue = res.data.realDatas[i]
           temp.value1 = value.value1[i]
           temp.value1 = value.value1[i]
           temp.value2 = value.value2[i]
           temp.value2 = value.value2[i]
           temp.value3 = value.value3[i]
           temp.value3 = value.value3[i]
@@ -187,6 +187,9 @@ export default {
     },
     },
     handlePageChange({currentPage, pageSize}) {
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       this.currentPage = currentPage
+      if (this.pageSize != pageSize) {
+        this.currentPage =1
+      }
       this.pageSize = pageSize
       this.pageSize = pageSize
       this.startTime = this.queryStartTime
       this.startTime = this.queryStartTime
     },
     },

+ 2 - 6
ipfcst-console/src/main/frontend/views/dataquery/nwp/charts/index.vue

@@ -280,8 +280,7 @@ export default {
           text: 'nwp信息',
           text: 'nwp信息',
           textStyle: {
           textStyle: {
             fontWeight: 'normal',
             fontWeight: 'normal',
-            fontSize: 16,
-            color: '#79acff'
+            fontSize: 16
           },
           },
           left: '1%'
           left: '1%'
         },
         },
@@ -311,8 +310,7 @@ export default {
           data: [],
           data: [],
           right: '4%',
           right: '4%',
           textStyle: {
           textStyle: {
-            fontSize: 12,
-            color: '#79acff'
+            fontSize: 12
           },
           },
           selected: {}
           selected: {}
         },
         },
@@ -341,7 +339,6 @@ export default {
           boundaryGap: false,
           boundaryGap: false,
           axisLine: {
           axisLine: {
             lineStyle: {
             lineStyle: {
-              color: '#79acff'
             }
             }
           },
           },
           data: []
           data: []
@@ -354,7 +351,6 @@ export default {
           },
           },
           axisLine: {
           axisLine: {
             lineStyle: {
             lineStyle: {
-              color: '#79acff'
             }
             }
           },
           },
 
 

+ 5 - 1
ipfcst-console/src/main/frontend/views/dataquery/nwp/index.vue

@@ -74,7 +74,7 @@
                 background
                 background
                 :loading="loading"
                 :loading="loading"
                 :current-page.sync="currentPage"
                 :current-page.sync="currentPage"
-                :page-size.sync="pageSize"
+                :page-size="pageSize"
                 :total="total"
                 :total="total"
                 @page-change="handlePageChange"
                 @page-change="handlePageChange"
                 :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
                 :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
@@ -208,6 +208,10 @@ export default {
     },
     },
     handlePageChange({currentPage, pageSize}) {
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       this.currentPage = currentPage
+
+      if (this.pageSize != pageSize) {
+        this.currentPage =1
+      }
       this.pageSize = pageSize
       this.pageSize = pageSize
       this.startTime = this.queryStartTime
       this.startTime = this.queryStartTime
       this.endTime = this.queryEndTime
       this.endTime = this.queryEndTime

+ 7 - 5
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ForecastPowerUltraShortTermService.java

@@ -51,6 +51,8 @@ public class ForecastPowerUltraShortTermService extends BaseService {
   ForecastPowerUltraShortTermHisRepository forecastPowerUltraShortTermHisRepository;
   ForecastPowerUltraShortTermHisRepository forecastPowerUltraShortTermHisRepository;
   @Autowired
   @Autowired
   ForecastPowerShortTermService forecastPowerShortTermService;
   ForecastPowerShortTermService forecastPowerShortTermService;
+  @Autowired
+  PowerStationStatusDataService powerStationStatusDataService;
 
 
   /**
   /**
    * 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
    * 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
@@ -433,7 +435,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
   public Map<String, Object> findByForecastRealTimeUltraShortTerm16(Long startTime, String stationCode) {
   public Map<String, Object> findByForecastRealTimeUltraShortTerm16(Long startTime, String stationCode) {
     long endTime = startTime + 60 * 60 * 1000 * 24;
     long endTime = startTime + 60 * 60 * 1000 * 24;
-//    List<Map<String,Object>> valueList16 = new ArrayList<>();
     //取出16点数据存入集合中
     //取出16点数据存入集合中
     Map<String, Object> realPowerMap = new HashMap<>();
     Map<String, Object> realPowerMap = new HashMap<>();
     List<ForecastPowerUltraShortTermHis> forecastPowerUltraShortTermHisList = forecastPowerUltraShortTermHisRepository.findByForecastTimeBetweenAndStationCode(startTime, endTime, stationCode);
     List<ForecastPowerUltraShortTermHis> forecastPowerUltraShortTermHisList = forecastPowerUltraShortTermHisRepository.findByForecastTimeBetweenAndStationCode(startTime, endTime, stationCode);
@@ -447,7 +448,6 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         startTime = startTime - (startTime % timeStep);
         startTime = startTime - (startTime % timeStep);
       }
       }
       List<Float> ableDatas = new ArrayList<>();
       List<Float> ableDatas = new ArrayList<>();
-
       for (long i = startTime; i < endTime; i = i + 900000L) {
       for (long i = startTime; i < endTime; i = i + 900000L) {
         long finalI = i;
         long finalI = i;
         List<ForecastPowerUltraShortTermHis> p1 = filterList.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
         List<ForecastPowerUltraShortTermHis> p1 = filterList.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
@@ -458,15 +458,17 @@ public class ForecastPowerUltraShortTermService extends BaseService {
           } else {
           } else {
             ableDatas.add(p1.get(0).getAbleValue().floatValue());
             ableDatas.add(p1.get(0).getAbleValue().floatValue());
           }
           }
+
         } else {
         } else {
-          ableDatas.add(null);
+          ableDatas.add(0f);
         }
         }
+
       }
       }
       realPowerMap.put("value" + p, ableDatas);
       realPowerMap.put("value" + p, ableDatas);
     }
     }
 
 
-    //Map<String, Object> map = powerStationStatusDataService.findByTimeBetweenForContrast(new Date(startTime), new Date(endTime), 900000l);
-    Map<String, Object> map = new HashMap<>();
+    Map<String, Object> map = powerStationStatusDataService.findByTimeBetweenForContrast(new Date(startTime), new Date(endTime), 900000l);
+
     ElectricField electricField = electricFieldService.getSingleStation(stationCode);
     ElectricField electricField = electricFieldService.getSingleStation(stationCode);
     map.put("value", realPowerMap);
     map.put("value", realPowerMap);
     map.put("capacity", electricField.getCapacity());
     map.put("capacity", electricField.getCapacity());

+ 213 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PowerStationStatusDataService.java

@@ -0,0 +1,213 @@
+package com.jiayue.ipfcst.console.service;
+import com.jiayue.ipfcst.common.data.entity.PowerStationStatusData;
+import com.jiayue.ipfcst.common.data.repository.PowerStationStatusDataRepository;
+import com.jiayue.ipfcst.common.data.service.BaseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 实际功率
+ */
+@Service
+public class PowerStationStatusDataService extends BaseService {
+
+  private final PowerStationStatusDataRepository powerStationStatusDataRepository;
+
+  @Autowired
+  public PowerStationStatusDataService(PowerStationStatusDataRepository powerStationStatusDataRepository) {
+    this.powerStationStatusDataRepository = powerStationStatusDataRepository;
+  }
+
+
+  /**
+   * 根据开始时间和结束时间查询 场站功率状态
+   * 超短期数据展示搭配实际功率使用
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   * @return 结果集
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public Map<String, Object> findByTimeBetweenForContrast(Date startTime, Date endTime, Long timeStep) {
+    Map<String, Object> map = new HashMap<>();
+    List<PowerStationStatusData> list = new ArrayList<>();
+
+    list = powerStationStatusDataRepository.findByTimeBetween(startTime, endTime);
+
+
+    long startTimeLong = startTime.getTime();
+    long endTimeLong = endTime.getTime();
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    if (startTimeLong % timeStep != 0) {
+      startTimeLong = startTimeLong - (startTimeLong % timeStep);
+    }
+    List<Float> realDatas = new ArrayList<>();
+    List<Float> ableDatas = new ArrayList<>();
+    List<Float> theoryDatas = new ArrayList<>();
+    List<Float> referencePowerByMeasuringDatas = new ArrayList<>();
+    List<Float> referencePowerBySampleDatas = new ArrayList<>();
+    List<String> times = new ArrayList<>();
+
+    for (long i = startTimeLong; i < endTimeLong; i = i + timeStep) {
+      long finalI = i;
+      List<PowerStationStatusData> p = list.stream().filter(t -> t.getTime().getTime() == finalI).collect(Collectors.toList());
+      if (p != null && p.size() > 0) {
+
+        if (p.get(0).getRealValue().compareTo(new BigDecimal(-99)) == 0) {
+          realDatas.add(null);
+        } else {
+          realDatas.add(p.get(0).getRealValue().floatValue());
+        }
+
+        if (p.get(0).getAbleValue().compareTo(new BigDecimal(-99)) == 0) {
+          ableDatas.add(null);
+        } else {
+          ableDatas.add(p.get(0).getAbleValue().floatValue());
+        }
+
+        if (p.get(0).getTheoryValue().compareTo(new BigDecimal(-99)) == 0) {
+          theoryDatas.add(null);
+        } else {
+          theoryDatas.add(p.get(0).getTheoryValue().floatValue());
+        }
+
+        if (p.get(0).getReferencePowerByMeasuring().compareTo(new BigDecimal(-99)) == 0) {
+          referencePowerByMeasuringDatas.add(null);
+        } else {
+          referencePowerByMeasuringDatas.add(p.get(0).getReferencePowerByMeasuring().floatValue());
+        }
+
+        if (p.get(0).getReferencePowerBySample().compareTo(new BigDecimal(-99)) == 0) {
+          referencePowerBySampleDatas.add(null);
+        } else {
+          referencePowerBySampleDatas.add(p.get(0).getReferencePowerBySample().floatValue());
+        }
+        String timeFormat = sdf.format(new Date(i));
+        times.add(timeFormat);
+
+      } else {
+        String timeFormat = sdf.format(new Date(i));
+        times.add(timeFormat);
+        realDatas.add(null);
+        ableDatas.add(null);
+        theoryDatas.add(null);
+        referencePowerByMeasuringDatas.add(null);
+        referencePowerBySampleDatas.add(null);
+
+      }
+    }
+
+
+    map.put("times", times);
+    map.put("realDatas", realDatas);
+    map.put("ableDatas", ableDatas);
+    map.put("theoryDatas", theoryDatas);
+    map.put("referencePowerByMeasuringDatas", referencePowerByMeasuringDatas);
+    map.put("referencePowerBySampleDatas", referencePowerBySampleDatas);
+
+    return map;
+  }
+
+
+  /**
+   * 对集合进行 -99替换null操作,主要用于图标展示空值
+   *
+   * @param datas 需要替换集合
+   */
+  public void defaultReplace(List<PowerStationStatusData> datas) {
+    BigDecimal nullBig = new BigDecimal(-99);
+    for (PowerStationStatusData p : datas) {
+      if (p.getRealValue().compareTo(nullBig) == 0) {
+        p.setRealValue(null);
+      }
+      if (p.getAbleValue().compareTo(nullBig) == 0) {
+        p.setAbleValue(null);
+      }
+      if (p.getTheoryValue().compareTo(nullBig) == 0) {
+        p.setTheoryValue(null);
+      }
+      if (p.getOpenCapacity().compareTo(nullBig) == 0) {
+        p.setOpenCapacity(null);
+      }
+      if (p.getCapacity().compareTo(nullBig) == 0) {
+        p.setCapacity(null);
+      }
+      if (p.getOnSiteObstructed().compareTo(nullBig) == 0) {
+        p.setOnSiteObstructed(null);
+      }
+      if (p.getOffSiteObstructed().compareTo(nullBig) == 0) {
+        p.setOffSiteObstructed(null);
+      }
+    }
+
+  }
+
+  /**
+   * 受阻电量查询(已废弃)
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<Map<String, Object>> findBalkPower(Date startTime, Date endTime) {
+
+    List<Map<String, Object>> resultList = new ArrayList<>();
+
+
+    List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetween(startTime, endTime);
+
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    for (PowerStationStatusData powerStationStatusData : powerStationStatusDataList) {
+      Map<String, Object> map = new HashMap<>();
+      map.put("time", sdf.format(powerStationStatusData.getTime()));
+      map.put("onSiteObstructed", powerStationStatusData.getOnSiteObstructed());
+      map.put("offSiteObstructed", powerStationStatusData.getOffSiteObstructed());
+      BigDecimal b = powerStationStatusData.getAbleValue().subtract(powerStationStatusData.getRealValue());
+      if (powerStationStatusData.getRealValue().floatValue() != 0) {
+        map.put("abandonmentRate", b.divide(powerStationStatusData.getRealValue(), 2, BigDecimal.ROUND_HALF_UP));
+      } else {
+        map.put("abandonmentRate", 0);
+      }
+
+      resultList.add(map);
+
+    }
+
+//    Sort sort = Sort.by(Sort.Direction.DESC, "time");
+//    if (sortOrder.contains("asc")) {
+//      sort = Sort.by(Sort.Direction.ASC, "time");
+//    }
+//    Specification<PowerStationStatusData> specification = this.Specification(startTime, endTime);
+//    Pageable pageable = PageRequest.of(page - 1, size, sort);
+//    Page pages = powerStationStatusDataRepository.findAll(specification, pageable);
+//    List<PowerStationStatusData> datas = new ArrayList<>();
+//    datas = pages.getContent();
+//    map.put("content", datas);
+//    map.put("count", pages.getTotalElements());
+
+    return resultList;
+
+
+  }
+
+  /**
+   * 根据时间查询数据并根据时间正序排序
+   *
+   * @param startTime 开始时间
+   * @param endTime   结束时间
+   */
+  @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
+  public List<PowerStationStatusData> findByTimeBetween(Long startTime, Long endTime) {
+    List<PowerStationStatusData> powerStationStatusDataList = powerStationStatusDataRepository.findByTimeBetween(new Date(startTime), new Date(endTime));
+    Collections.sort(powerStationStatusDataList, Comparator.comparing(PowerStationStatusData::getTime));
+    return powerStationStatusDataList;
+  }
+}
+