Przeglądaj źródła

1.加入client代码加入不传备机文件开关
2.修改查询超短期历史数据

wangtao 3 lat temu
rodzic
commit
bbcfa31a84

+ 3 - 3
ipfcst-client/focus-client.yml

@@ -1,13 +1,13 @@
 #青海client小程序使用jar包外配置文件
 remote:
-  ip: 192.168.26.32
+  ip: flase
   port: 22
   user: root
   pwd: Syjy*3377
-  path: /home/syjy/ipfcstV3/downLoadFile/
+  path: /home/syjy/ipfcstV3/downloadFile/
   dcUrl: http://cloud.jiayuepowertech.com:9001/qinghaiComeBackApi/datas
 v3cloud:
   filelogUrl: https://117.78.19.70:9010/client/getDownLoadFileAll/
   fileDownUrl: https://117.78.19.70:9010/client/getFileById?id=
 local:
-  downFilePath: /home/syjy/ipfcstV3/downLoadFile/
+  downFilePath: /home/syjy/ipfcstV3/downloadFile/

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

@@ -86,7 +86,10 @@ public class DownloadFileJob {
                 if (!filedownLoadList.isEmpty()) {
                     log.debug("开始移动下载文件到功率预测,共:{} 个文件。", filedownLoadList.size());
                     for (String filePath : filedownLoadList) {
-
+                        if ("flase".equals(properties.getProperty("remote.ip"))) {
+                            log.warn("备机配置为空,不需要传文件到备机上。");
+                            break;
+                        }
                         Scpclient scpclient = Scpclient.getInstance(properties.getProperty("remote.ip"),
                                 Convert.toInt(properties.getProperty("remote.port")), properties.getProperty("remote.user"),
                                 properties.getProperty("remote.pwd"));

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

@@ -7,14 +7,14 @@
         <el-date-picker
           v-model="startTime"
           :clearable="false"
+          placeholder="选择日期"
           type="date"
-          value-format="timestamp"
-          placeholder="选择日期">
+          value-format="timestamp">
         </el-date-picker>
       </div>
       <div style="display: inline-block">
         <span style="font-weight: bold;font-size: 14px">&#12288;场站名称:</span>
-        <el-select style="width:250px" clearable v-model="stationCode" size="small">
+        <el-select v-model="stationCode" clearable size="small" style="width:250px">
           <el-option
             v-for="item in stationList"
             :key="item.stationCode"
@@ -26,57 +26,57 @@
         </el-select>
       </div>
       <div class="timeQuery" style="display: inline-block">
-        <el-button size="small" :loading="loading" @click="dateQuery">&#12288;查询</el-button>
+        <el-button :loading="loading" size="small" @click="dateQuery">&#12288;查询</el-button>
       </div>
 
     </div>
     <br/>
     <div class="content">
-      <el-tabs type="card" v-model="activeName">
+      <el-tabs v-model="activeName" type="card">
         <el-tab-pane label="表格" name="first">
           <div class="tableContent">
             <vxe-table
               id="fstTable"
               ref="fstRef"
+              :auto-resize="true"
+              :custom-config="{storage: true, checkMethod: checkColumnMethod}"
+              :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
+              :loading="loading"
+              align="center"
               border
               export-config
-              :loading="loading"
-              @sort-change="sortChangeEvent"
-              :custom-config="{storage: true, checkMethod: checkColumnMethod}"
-              :auto-resize="true"
               highlight-hover-row
               max-height="90%"
-              align="center"
-              :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)">
-              <vxe-table-column field="times" title="预测时间" :formatter="dateFormat" width="180" sortable
-                                min-width="150"></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="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="value4" title="第4个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value5" title="第5个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value6" title="第6个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value7" title="第7个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value8" title="第8个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value9" title="第9个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value10" title="第10个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value11" title="第11个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value12" title="第12个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value13" title="第13个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value14" title="第14个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value15" title="第15个时刻" min-width="60"></vxe-table-column>
-              <vxe-table-column field="value16" title="第16个时刻" min-width="60"></vxe-table-column>
+              @sort-change="sortChangeEvent">
+              <vxe-table-column :formatter="dateFormat" field="times" min-width="150" sortable title="预测时间"
+                                width="180"></vxe-table-column>
+              <vxe-table-column field="realValue" min-width="60" title="实际功率"></vxe-table-column>
+              <vxe-table-column field="value1" min-width="60" title="第1个时刻"></vxe-table-column>
+              <vxe-table-column field="value2" min-width="60" title="第2个时刻"></vxe-table-column>
+              <vxe-table-column field="value3" min-width="60" title="第3个时刻"></vxe-table-column>
+              <vxe-table-column field="value4" min-width="60" title="第4个时刻"></vxe-table-column>
+              <vxe-table-column field="value5" min-width="60" title="第5个时刻"></vxe-table-column>
+              <vxe-table-column field="value6" min-width="60" title="第6个时刻"></vxe-table-column>
+              <vxe-table-column field="value7" min-width="60" title="第7个时刻"></vxe-table-column>
+              <vxe-table-column field="value8" min-width="60" title="第8个时刻"></vxe-table-column>
+              <vxe-table-column field="value9" min-width="60" title="第9个时刻"></vxe-table-column>
+              <vxe-table-column field="value10" min-width="60" title="第10个时刻"></vxe-table-column>
+              <vxe-table-column field="value11" min-width="60" title="第11个时刻"></vxe-table-column>
+              <vxe-table-column field="value12" min-width="60" title="第12个时刻"></vxe-table-column>
+              <vxe-table-column field="value13" min-width="60" title="第13个时刻"></vxe-table-column>
+              <vxe-table-column field="value14" min-width="60" title="第14个时刻"></vxe-table-column>
+              <vxe-table-column field="value15" min-width="60" title="第15个时刻"></vxe-table-column>
+              <vxe-table-column field="value16" min-width="60" title="第16个时刻"></vxe-table-column>
             </vxe-table>
             <div class="rtPageturning">
               <vxe-pager
-                background
-                :loading="loading"
                 :current-page.sync="currentPage"
+                :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
+                :loading="loading"
                 :page-size.sync="pageSize"
                 :total="tableData.length"
-                @page-change="handlePageChange"
-                :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']">
+                background
+                @page-change="handlePageChange">
               </vxe-pager>
             </div>
           </div>
@@ -188,7 +188,7 @@ export default {
     handlePageChange({currentPage, pageSize}) {
       this.currentPage = currentPage
       if (this.pageSize != pageSize) {
-        this.currentPage =1
+        this.currentPage = 1
       }
       this.pageSize = pageSize
       this.startTime = this.queryStartTime

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

@@ -37,6 +37,7 @@ import java.util.stream.Collectors;
 @Service
 @Slf4j
 public class ForecastPowerUltraShortTermService extends BaseService {
+  private final String format = "yyyy-MM-dd HH:mm:ss";
   @Autowired
   ElectricFieldService electricFieldService;
   @Autowired
@@ -53,7 +54,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
   ForecastPowerShortTermService forecastPowerShortTermService;
   @Autowired
   PowerStationStatusDataService powerStationStatusDataService;
-  private final String format = "yyyy-MM-dd HH:mm:ss";
+
   /**
    * 获取超短期预测功率,当数据库中超短期预测记录不足查询所需时,进行本地化计算,用于上报专用
    *
@@ -70,7 +71,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     // 查询预测时间点对应的开机容量
     Map<Long, BigDecimal> openCapacityMap = null;
     try {
-      openCapacityMap =  super.queryOpenCapacity(startTime, endTime, electricFieldInfo.getCapacity(), stationCode);
+      openCapacityMap = super.queryOpenCapacity(startTime, endTime, electricFieldInfo.getCapacity(), stationCode);
     } catch (BusinessException e) {
       log.error(stationCode + "超短期数据生成获取开机容量出错:" + CommonUtil.printStackTraceToString(e));
     }
@@ -176,7 +177,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         PowerStationStatusData realPower = realPowerList.get(0);
         // 将实际功率替换到对应的超短期点位上
         ForecastPowerUltraShortTermHis d = forecastPowerUltraShortTermHiss.get(replacePoint - 1);
-        if (realPower.getRealValue().compareTo(new BigDecimal(0)) >=0) {
+        if (realPower.getRealValue().compareTo(new BigDecimal(0)) >= 0) {
           d.setAbleValue(realPower.getRealValue());
         }
       }
@@ -219,22 +220,22 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         // 根据场站类型执行相应超短期预测
         try {
           // 获取查询时间,从当前时间所处时间点标记时间开始查询,截至到96个时间点对应的标记时间
-          String cdqUpMin = super.getSysParameter("CDQ_UP_MIN", "0",stationCode);
+          String cdqUpMin = super.getSysParameter("CDQ_UP_MIN", "0", stationCode);
           Long calTime = DateMomentUtil.getMomentTime(System.currentTimeMillis() + Integer.parseInt(cdqUpMin) * 1000 * 60, 1, 15 * 60 * 1000L);
           Long startTime = calTime + 15 * 1000 * 60L;
-          String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16",stationCode);
+          String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16", stationCode);
           Integer forecastPoints = Integer.parseInt(llcdq_point);
           Integer forecastMinutes = forecastPoints * 15;
           // 结束时间增加15分钟为了防止文件先生成,实时表中最后一个时间点没有点位的问题
           Long endTime = DateUtils.addMinutes(new Date(startTime), forecastMinutes).getTime() + 1000 * 60 * 15L;
 
           // 查询该时间段内的短期预测功率
-          List<ForecastPowerShortTerm> forecastPowerShortTermList = this.forecastPowerShortTermRepository.findByForecastTimeBetweenAndStationCode(startTime, endTime,stationCode);
+          List<ForecastPowerShortTerm> forecastPowerShortTermList = this.forecastPowerShortTermRepository.findByForecastTimeBetweenAndStationCode(startTime, endTime, stationCode);
           Map<Long, List<ForecastPowerShortTerm>> forecastPowerShortTermsMap =
             forecastPowerShortTermList.stream().collect(Collectors.groupingBy(ForecastPowerShortTerm::getForecastTime));
           Map<Long, BigDecimal> openCapacityMap = null;
           try {
-            openCapacityMap = super.queryOpenCapacity(startTime, endTime, electricField.getCapacity(),stationCode);
+            openCapacityMap = super.queryOpenCapacity(startTime, endTime, electricField.getCapacity(), stationCode);
           } catch (BusinessException e) {
             log.error("预测数据生成获取开机容量出错:" + CommonUtil.printStackTraceToString(e));
           }
@@ -247,7 +248,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
               if (ElectricFieldTypeEnum.E1.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
                 forecastPowerShortTerms = forecastPowerShortTermService.generateSolarPowerShortTerm(tempTime, openCapacityMap.get(tempTime), electricField);
               } else {
-                forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap.get(tempTime),stationCode);
+                forecastPowerShortTerms = forecastPowerShortTermService.generateWindPowerShortTerm(tempTime, openCapacityMap.get(tempTime), stationCode);
               }
               addForecastPowerShortTermList.add(forecastPowerShortTerms);
             }
@@ -262,10 +263,10 @@ public class ForecastPowerUltraShortTermService extends BaseService {
 
           if (ElectricFieldTypeEnum.E1.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
             // 光伏电站
-            this.executeForecastForlight(forecastPowerShortTermList, electricField.getCapacity(),stationCode);
+            this.executeForecastForlight(forecastPowerShortTermList, electricField.getCapacity(), stationCode);
           } else if (ElectricFieldTypeEnum.E2.compareTo(electricField.getElectricFieldTypeEnum()) == 0) {
             // 风力电场
-            this.executeForecastForWind(forecastPowerShortTermList, electricField.getCapacity(),stationCode);
+            this.executeForecastForWind(forecastPowerShortTermList, electricField.getCapacity(), stationCode);
           } else {
             log.error("场站类型非法!");
           }
@@ -295,7 +296,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     Date currentTime = new Date(System.currentTimeMillis());
     Date startTime = DateUtils.addMinutes(currentTime, -10);
     Date endTime = DateUtils.addMinutes(currentTime, 1);
-    List<PowerStationStatusData> powerStationStatusDataList = this.powerStationStatusDataRepository.findByTimeBetweenAndStationCode(startTime, endTime,stationCode);
+    List<PowerStationStatusData> powerStationStatusDataList = this.powerStationStatusDataRepository.findByTimeBetweenAndStationCode(startTime, endTime, stationCode);
     List<PowerStationStatusData> filterList = powerStationStatusDataList.stream().filter(t -> t.getAbleValue().compareTo(new BigDecimal("-1")) > 0).collect(Collectors.toList());
     String coe = super.getSysParameter("CDQ_COE", "1.05", stationCode);
 
@@ -305,7 +306,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     } catch (Exception e) {
       log.error("获取当前时刻错误", e);
     }
-    String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16",stationCode);
+    String llcdq_point = sysParameterService.getSysParameter("FILE_LLCDQ_POINT", "16", stationCode);
     Integer forecastPoints = Integer.parseInt(llcdq_point);
     if (filterList.size() > 0) {
       // 获取当前时刻对应的短期
@@ -313,11 +314,10 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       BigDecimal currentForecastPowerValue = BigDecimal.ZERO;
       try {
         Long currentMoment = DateMomentUtil.getMomentTime(currentTime.getTime(), 1, 15 * 60 * 1000L);
-        currentForecastPowerShortTermList = this.forecastPowerShortTermRepository.findByForecastTimeBetweenAndStationCode(currentMoment, currentMoment,stationCode);
-        if (currentForecastPowerShortTermList.size()<=0){
+        currentForecastPowerShortTermList = this.forecastPowerShortTermRepository.findByForecastTimeBetweenAndStationCode(currentMoment, currentMoment, stationCode);
+        if (currentForecastPowerShortTermList.size() <= 0) {
           currentForecastPowerValue = currentForecastPowerShortTermList.get(0).getFpValue();
-        }
-        else{
+        } else {
           // 当前时间没有对应的短期,用实际功率最近的一个替换
           filterList.sort(Comparator.comparing(PowerStationStatusData::getTime).reversed());
           currentForecastPowerValue = filterList.get(0).getAbleValue();
@@ -373,7 +373,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
         forecastPowerUltraShortTermList.add(forecastPowerUltraShortTerm);
       }
     } else {
-      log.info(stationCode+"库中没有可用,本次可用计算数据采用短期*系数的方式生成数据");
+      log.info(stationCode + "库中没有可用,本次可用计算数据采用短期*系数的方式生成数据");
 
       // 短期乘以系数
       for (int i = 0; i < forecastPoints; i++) {
@@ -422,7 +422,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
     if (startTime % timeStep != 0) {
       startTime = startTime - (startTime % timeStep) + timeStep;
     }
-    if ( list.size() > 0) {
+    if (list.size() > 0) {
       for (long i = startTime; i < endTime; i = i + timeStep) {
         long finalI = i;
         List<ForecastPowerUltraShortTermHis> filterList = list.stream().filter(t -> t.getForecastTime() == finalI).collect(Collectors.toList());
@@ -483,7 +483,7 @@ public class ForecastPowerUltraShortTermService extends BaseService {
       realPowerMap.put("value" + p, ableDatas);
     }
 
-    Map<String, Object> map = powerStationStatusDataService.findByTimeBetweenForContrast(new Date(startTime), new Date(endTime), 900000l);
+    Map<String, Object> map = powerStationStatusDataService.findByTimeBetweenForContrast(new Date(startTime), new Date(endTime), 900000l, stationCode);
 
     ElectricField electricField = electricFieldService.getSingleStation(stationCode);
     map.put("value", realPowerMap);

+ 20 - 19
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/PowerStationStatusDataService.java

@@ -1,4 +1,5 @@
 package com.jiayue.ipfcst.console.service;
+
 import com.jiayue.ipfcst.common.core.exception.BusinessException;
 import com.jiayue.ipfcst.common.data.entity.ElectricField;
 import com.jiayue.ipfcst.common.data.entity.PowerStationStatusData;
@@ -40,24 +41,24 @@ public class PowerStationStatusDataService extends BaseService {
   /**
    * 分页查询 场站功率状态 yh
    *
-   * @param startTime 开始时间
-   * @param endTime   结束时间
-   * @param page      页码
-   * @param size      条数
-   * @param stationCode   场站编号
-   * @param sortOrder 排序
+   * @param startTime   开始时间
+   * @param endTime     结束时间
+   * @param page        页码
+   * @param size        条数
+   * @param stationCode 场站编号
+   * @param sortOrder   排序
    * @return
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
   public Map<String, Object> findByTimeBetweenForPaging(Date startTime, Date endTime,
-                                                        Integer page, Integer size,String stationCode,
+                                                        Integer page, Integer size, String stationCode,
                                                         String sortOrder) {
     Map<String, Object> map = new HashMap<>();
     Sort sort = Sort.by(Sort.Direction.ASC, "time");
     if (sortOrder.contains("desc")) {
       sort = Sort.by(Sort.Direction.DESC, "time");
     }
-    Specification<PowerStationStatusData> specification = this.Specification(startTime, endTime,stationCode);
+    Specification<PowerStationStatusData> specification = this.Specification(startTime, endTime, stationCode);
     Pageable pageable = PageRequest.of(page - 1, size, sort);
     Page powerStationStatusData = powerStationStatusDataRepository.findAll(specification, pageable);
     List<PowerStationStatusData> datas = new ArrayList<>();
@@ -98,6 +99,7 @@ public class PowerStationStatusDataService extends BaseService {
     map.put("count", powerStationStatusData.getTotalElements());
     return map;
   }
+
   /**
    * 对集合进行 -99替换null操作,主要用于图标展示空值
    *
@@ -130,6 +132,7 @@ public class PowerStationStatusDataService extends BaseService {
     }
 
   }
+
   /**
    * 查询条件 yh
    *
@@ -137,10 +140,10 @@ public class PowerStationStatusDataService extends BaseService {
    * @param endTime   结束时间
    * @return 过滤条件
    */
-  Specification<PowerStationStatusData> Specification(final Date startTime, final Date endTime,final String stationCode) {
-    return (Specification<PowerStationStatusData>) (root, criteriaQuery, cb) -> {
+  Specification<PowerStationStatusData> Specification(final Date startTime, final Date endTime, final String stationCode) {
+    return (root, criteriaQuery, cb) -> {
       List<Predicate> predicates = new ArrayList<>();
-      predicates.add(cb.equal(root.get("stationCode").as(String.class),stationCode));
+      predicates.add(cb.equal(root.get("stationCode").as(String.class), stationCode));
       if (startTime != null) {
         //大于或等于传入时间
         predicates.add(cb.greaterThanOrEqualTo(root.get("time").as(Date.class), startTime));
@@ -154,6 +157,7 @@ public class PowerStationStatusDataService extends BaseService {
 
     };
   }
+
   /**
    * 根据开始时间和结束时间查询 场站功率状态 yh
    *
@@ -162,7 +166,7 @@ public class PowerStationStatusDataService extends BaseService {
    * @return 结果集
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByTimeBetweenAndStationCode(Date startTime, Date endTime,String stationCode){
+  public Map<String, Object> findByTimeBetweenAndStationCode(Date startTime, Date endTime, String stationCode) {
     Map<String, Object> map = new HashMap<>();
     ElectricField electricField = null;
     try {
@@ -173,7 +177,7 @@ public class PowerStationStatusDataService extends BaseService {
     map.put("cap", electricField.getCapacity());
     List<PowerStationStatusData> list = new ArrayList<>();
     List<PowerStationStatusData> checkList = new ArrayList<>();
-    list = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(startTime, endTime,stationCode);
+    list = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(startTime, endTime, stationCode);
 
     long startTimeLong = startTime.getTime();
     long endTimeLong = endTime.getTime();
@@ -317,13 +321,10 @@ public class PowerStationStatusDataService extends BaseService {
    * @return 结果集
    */
   @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
-  public Map<String, Object> findByTimeBetweenForContrast(Date startTime, Date endTime, Long timeStep) {
+  public Map<String, Object> findByTimeBetweenForContrast(Date startTime, Date endTime, Long timeStep, String stationCode) {
     Map<String, Object> map = new HashMap<>();
-    List<PowerStationStatusData> list = new ArrayList<>();
-
-    list = powerStationStatusDataRepository.findByTimeBetween(startTime, endTime);
-
-
+    List<PowerStationStatusData> list = powerStationStatusDataRepository.findByTimeBetweenAndStationCode(startTime, endTime, stationCode);
+    
     long startTimeLong = startTime.getTime();
     long endTimeLong = endTime.getTime();
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");