Przeglądaj źródła

风机风资源计算优化

wangb 1 miesiąc temu
rodzic
commit
86c2c065c3

+ 41 - 35
generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -1598,44 +1598,50 @@ public class WindPowerInfo1Service {
 
     }
 
-//    public void writeReportHistory(Date date) throws Exception {
-////        String[] dateTime = {"2024-12-13 08:00:00","2024-12-13 12:00:00", "2024-12-13 16:00:00", "2024-12-13 20:00:00"};
-//        String[] dateTime = {"2025-08-04 12:00:00"};
-//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+    public void writeReportHistory(Date date) throws Exception {
+//        String[] dateTime = {"2024-12-13 08:00:00","2024-12-13 12:00:00", "2024-12-13 16:00:00", "2024-12-13 20:00:00"};
+        String[] dateTime = {"2025-08-04 12:00:00"};
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        QueryWrapper<ProBaseBackfill> qwf = new QueryWrapper<>();
+        qwf.lambda().eq(ProBaseBackfill::getType, "AI0005");
+        List<ProBaseBackfill> list = iProBaseBackfillService.list(qwf);
+        List<String> ls = list.stream().map(ProBaseBackfill::getCode).collect(Collectors.toList());
+
 //        String[] split = repInfo1.split(",");
 //        List<String> ls = new ArrayList<>(Arrays.asList(split));
-//        for (String s : dateTime) {
-//            Date date1 = simpleDateFormat.parse(s);
-//            long timestamp = date1.getTime();
-////            for (long i = timestamp; i < 1735033631000L; i += 86400000) {
-//            List<StationInfoHour> shs = new ArrayList<>();
-//            for (String l : ls) {
-////                    Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), l, i);
-//                Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), l, timestamp);
-//                if (null == historySection || historySection.isEmpty()) {
-//                    return;
-//                }
-//                StationInfoHour sh = new StationInfoHour();
-////                        sh.setRecordDate(LocalDateTime.ofInstant(Instant.ofEpochMilli(i),ZoneId.systemDefault()));
-//                sh.setRecordDate(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()));
-//                sh.setWpid("NX_FGS_HA_FDC_STA");
-//                sh.setMeterId(l);
-//                sh.setMeterName(l);
-//                sh.setCode(BigDecimal.valueOf(historySection.get(l).getDoubleValue()));
-//                sh.setCodeModify(BigDecimal.valueOf(historySection.get(l).getDoubleValue()));
-//                shs.add(sh);
-//
-//            }
-//            try {
-//                boolean b = stationInfoHourService.saveBatch(shs);
-//            } catch (Exception e) {
-//                e.printStackTrace();
+        for (String s : dateTime) {
+            Date date1 = simpleDateFormat.parse(s);
+            long timestamp = date1.getTime();
+//            for (long i = timestamp; i < 1735033631000L; i += 86400000) {
+            List<StationInfoHour> shs = new ArrayList<>();
+            for (String l : ls) {
+//                    Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), l, i);
+                Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), l, timestamp);
+                if (null == historySection || historySection.isEmpty()) {
+                    return;
+                }
+                StationInfoHour sh = new StationInfoHour();
+//                        sh.setRecordDate(LocalDateTime.ofInstant(Instant.ofEpochMilli(i),ZoneId.systemDefault()));
+                sh.setRecordDate(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault()));
+                sh.setWpid("NX_FGS_HA_FDC_STA");
+                sh.setMeterId(l);
+                sh.setMeterName(l);
+                sh.setCode(BigDecimal.valueOf(historySection.get(l).getDoubleValue()));
+                sh.setCodeModify(BigDecimal.valueOf(historySection.get(l).getDoubleValue()));
+                shs.add(sh);
+
+            }
+            try {
+                boolean b = stationInfoHourService.saveBatch(shs);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
 //            }
-////            }
-//        }
-//
-//    }
+        }
+
+    }
 
 
     /**

+ 11 - 3
generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java

@@ -1419,8 +1419,17 @@ public class WtwindDayInfoService {
 
         //*******************************************年信息统计*********************************************************/
         if (pepid1ls.isEmpty()) {
-            setInfoYear(pewp);
-        } else {
+            int i = DateUtil.dayOfYear(begin);
+            if (i != 1) {
+                DateTime addDay = DateUtil.offset(begin, DateField.DAY_OF_MONTH, -1);
+                QueryWrapper<ProEconWtwindDayInfo> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.eq("record_date", addDay).eq("windTurbine_Id", pewp.getWindturbineId());
+                pepid1ls = proEconWtwindDayInfoService.list(queryWrapper2);
+            }else {
+                setInfoYear(pewp);
+            }
+
+        }
             ProEconWtwindDayInfo pepid = pepid1ls.get(0);
             //年静风次数
             pewp.setCf(pewp.getCa() + pepid.getCf());
@@ -1815,7 +1824,6 @@ public class WtwindDayInfoService {
             }
 
             //*******************************************************************************************************************/
-        }
 
 
     }