Browse Source

增加report_ha_windturbine定时任务

wangb 2 weeks ago
parent
commit
882256a133

+ 153 - 111
generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -54,16 +54,6 @@ public class WindPowerInfo1Service {
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
 
-    @Value("${ndgfzb.gf}")
-    private String gf;
-
-
-    @Value("${report.info1}")
-    private String repInfo1;
-
-    @Value("${report.info2}")
-    private String repInfo2;
-
 
     @Resource
     private IProEconAnalysisSubtableBottomService iProEconAnalysisSubtableBottomService;
@@ -1298,8 +1288,10 @@ public class WindPowerInfo1Service {
 
     public void writeGf(Date date) throws Exception {
         LocalDate localDate = LocalDateTime.now().toLocalDate();
-        String[] split = gf.split(",");
-        List<String> str = new ArrayList<>(Arrays.asList(split));
+        QueryWrapper<ProBaseBackfill> qwf = new QueryWrapper<>();
+        qwf.lambda().eq(ProBaseBackfill::getType, "AI0004");
+        List<ProBaseBackfill> list = iProBaseBackfillService.list(qwf);
+        List<String> str = list.stream().map(ProBaseBackfill::getCode).collect(Collectors.toList());
         List<PointData> realData = edosUtil.getRealData(str);
         QueryWrapper<ProEconAnalysisSubtableBottom> qw = new QueryWrapper<>();
         qw.lambda().eq(ProEconAnalysisSubtableBottom::getRecordDate, localDate);
@@ -1315,10 +1307,6 @@ public class WindPowerInfo1Service {
                     pb.setWpid("GJNY_NXGS_SGB_GDC_STA");
                 } else if ("霞光储能电站".equals(split1[2]) || "宁东32光伏场站".equals(split1[2])) {
                     pb.setWpid("GJNY_NXGS_XGB_GDC_STA");
-                } else if ("电度表".equals(split1[3])) {
-                    pb.setWpid("NX_FGS_HA_FDC_STA");
-                } else if ("区域集控".equals(split1[0]) && "惠安风场".equals(split1[1])) {
-                    pb.setWpid("NX_FGS_HA_FDC_STA");
                 } else {
                     pb.setWpid("GJNY_NXGS_QZB_GDC_STA");
                 }
@@ -1354,52 +1342,104 @@ public class WindPowerInfo1Service {
     }
 
 
-    public void writeGfHistory(Date date) throws Exception {
-        String s2 = "2024-12-11 23:55:00";
-        String[] split = gf.split(",");
-        List<String> str = new ArrayList<>(Arrays.asList(split));
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        Date date1 = simpleDateFormat.parse(s2);
-        long time = date1.getTime();
-        for (long i = time; i < 1735106823000L; i += 86400000) {
-            List<ProEconAnalysisSubtableBottom> ls = new ArrayList<>();
-            for (String s : str) {
-                Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), s, i);
+    public void writeHaWindturbine(Date date) throws Exception {
+        LocalDate localDate = LocalDateTime.now().toLocalDate();
+        QueryWrapper<ProBaseBackfill> qwf = new QueryWrapper<>();
+        qwf.lambda().eq(ProBaseBackfill::getType, "AI0003");
+        List<ProBaseBackfill> list = iProBaseBackfillService.list(qwf);
+        List<String> str = list.stream().map(ProBaseBackfill::getCode).collect(Collectors.toList());
+        List<PointData> realData = edosUtil.getRealData(str);
+        QueryWrapper<ProEconAnalysisSubtableBottom> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconAnalysisSubtableBottom::getRecordDate, localDate);
+        List<ProEconAnalysisSubtableBottom> sel = iProEconAnalysisSubtableBottomService.sel(qw);
+        List<ProEconAnalysisSubtableBottom> ls = null;
+        if (null == sel || sel.isEmpty()) {
+            ls = new ArrayList<>();
+            for (PointData real : realData) {
                 ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
-                pb.setRecordDate(new Date(i));
-                String[] split1 = s.split("\\.");
-                if ("曙光储能电站".equals(split1[2]) || "宁东33光伏场站".equals(split1[2])) {
-                    pb.setWpid("GJNY_NXGS_SGB_GDC_STA");
-                } else if ("霞光储能电站".equals(split1[2]) || "宁东32光伏场站".equals(split1[2])) {
-                    pb.setWpid("GJNY_NXGS_XGB_GDC_STA");
-                } else if ("电度表".equals(split1[3])) {
-                    pb.setWpid("NX_FGS_HA_FDC_STA");
-                } else if ("区域集控".equals(split1[0]) && "惠安风场".equals(split1[1])) {
-                    pb.setWpid("NX_FGS_HA_FDC_STA");
-                } else {
-                    pb.setWpid("GJNY_NXGS_QZB_GDC_STA");
-                }
-                pb.setMeterId(s);
-                pb.setMeterName(s);
-                pb.setStopCode(historySection.get(s).getDoubleValue());
-                pb.setStopCodeModify(historySection.get(s).getDoubleValue());
+                pb.setRecordDate(new Date(real.getPointTime()));
+                String[] split1 = real.getPointName().split("\\.");
+                pb.setWpid("NX_FGS_HA_FDC_STA");
+                pb.setMeterId(real.getPointName());
+                pb.setMeterName(real.getPointName());
+                pb.setStopCode(real.getPointValueInDouble());
+                pb.setStopCodeModify(real.getPointValueInDouble());
                 ls.add(pb);
             }
-            try {
-                boolean b = iProEconAnalysisSubtableBottomService.batchAdd(ls);
-            } catch (Exception e) {
-                e.printStackTrace();
+        } else {
+            ls = new ArrayList<>();
+            for (PointData real : realData) {
+                for (ProEconAnalysisSubtableBottom s : sel) {
+                    if (real.getPointName().equals(s.getMeterId())) {
+                        ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
+                        pb.setId(s.getId());
+                        pb.setStopCode(real.getPointValueInDouble());
+                        pb.setStopCodeModify(real.getPointValueInDouble());
+                        pb.setRecordDate(new Date(real.getPointTime()));
+                        pb.setMeterName(real.getPointName());
+                        pb.setMeterId(real.getPointName());
+                        ls.add(pb);
+                    }
+                }
             }
         }
+        try {
+            boolean b = iProEconAnalysisSubtableBottomService.batchAdd(ls);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
     }
 
 
+//    public void writeGfHistory(Date date) throws Exception {
+//        String s2 = "2024-12-11 23:55:00";
+//        String[] split = gf.split(",");
+//        List<String> str = new ArrayList<>(Arrays.asList(split));
+//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        Date date1 = simpleDateFormat.parse(s2);
+//        long time = date1.getTime();
+//        for (long i = time; i < 1735106823000L; i += 86400000) {
+//            List<ProEconAnalysisSubtableBottom> ls = new ArrayList<>();
+//            for (String s : str) {
+//                Map<String, PointData2> historySection = adapter.getHistorySection(goldenUri(), s, i);
+//                ProEconAnalysisSubtableBottom pb = new ProEconAnalysisSubtableBottom();
+//                pb.setRecordDate(new Date(i));
+//                String[] split1 = s.split("\\.");
+//                if ("曙光储能电站".equals(split1[2]) || "宁东33光伏场站".equals(split1[2])) {
+//                    pb.setWpid("GJNY_NXGS_SGB_GDC_STA");
+//                } else if ("霞光储能电站".equals(split1[2]) || "宁东32光伏场站".equals(split1[2])) {
+//                    pb.setWpid("GJNY_NXGS_XGB_GDC_STA");
+//                } else if ("电度表".equals(split1[3])) {
+//                    pb.setWpid("NX_FGS_HA_FDC_STA");
+//                } else if ("区域集控".equals(split1[0]) && "惠安风场".equals(split1[1])) {
+//                    pb.setWpid("NX_FGS_HA_FDC_STA");
+//                } else {
+//                    pb.setWpid("GJNY_NXGS_QZB_GDC_STA");
+//                }
+//                pb.setMeterId(s);
+//                pb.setMeterName(s);
+//                pb.setStopCode(historySection.get(s).getDoubleValue());
+//                pb.setStopCodeModify(historySection.get(s).getDoubleValue());
+//                ls.add(pb);
+//            }
+//            try {
+//                boolean b = iProEconAnalysisSubtableBottomService.batchAdd(ls);
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//        }
+//    }
+
+
     /**
      * 执行时间:00:00:00,04:00:00,08:00:00,12:00:00,16:00:00,20:00:00,
      */
     public void writeReport1(Date date) throws Exception {
-        String[] split = repInfo1.split(",");
-        List<String> ls = new ArrayList<>(Arrays.asList(split));
+        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());
         LocalDateTime currentTime = LocalDateTime.now();
         LocalDateTime modifiedTime = currentTime
                 .withMinute(0)
@@ -1429,52 +1469,54 @@ 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 = {"2024-12-25 00:00:00", "2024-12-25 04:00:00", "2024-12-25 08:00:00", "2024-12-24 20:00:00"};
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        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();
-            }
+//    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 = {"2024-12-25 00:00:00", "2024-12-25 04:00:00", "2024-12-25 08:00:00", "2024-12-24 20:00:00"};
+//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+//        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();
+//            }
+////            }
+//        }
+//
+//    }
 
 
     /**
      * 执行时间:01:00:00,05:00:00,09:00:00,13:00:00,17:00:00,21:00:00,
      */
     public void writeReport2(Date date) throws Exception {
-        String[] split = repInfo2.split(",");
-        List<String> ls = new ArrayList<>(Arrays.asList(split));
+        QueryWrapper<ProBaseBackfill> qwf = new QueryWrapper<>();
+        qwf.lambda().eq(ProBaseBackfill::getType, "AI0006");
+        List<ProBaseBackfill> list = iProBaseBackfillService.list(qwf);
+        List<String> ls = list.stream().map(ProBaseBackfill::getCode).collect(Collectors.toList());
         LocalDateTime currentTime = LocalDateTime.now();
         LocalDateTime modifiedTime = currentTime
                 .withMinute(0)
@@ -1506,7 +1548,7 @@ public class WindPowerInfo1Service {
 
     public void writeReportHistory2(Date date) throws Exception {
 //        String[] dateTime = {"2024-12-13 01:00:00", "2024-12-13 05:00:00", "2024-12-13 09:00:00","2024-12-13 13:00:00", "2024-12-13 17:00:00", "2024-12-13 21:00:00"};
-        String[] dateTime = {"2025-01-24 01:00:00", "2025-01-24 05:00:00", "2025-01-24 09:00:00","2025-01-24 13:00:00", "2025-01-24 17:00:00", "2025-01-24 21:00:00"};
+        String[] dateTime = {"2025-01-24 01:00:00", "2025-01-24 05:00:00", "2025-01-24 09:00:00", "2025-01-24 13:00:00", "2025-01-24 17:00:00", "2025-01-24 21:00:00"};
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 //        String[] split = repInfo2.split(",");
@@ -1518,28 +1560,28 @@ public class WindPowerInfo1Service {
             Date date1 = simpleDateFormat.parse(s);
             long timestamp = date1.getTime();
             for (long i = timestamp; i < 1740453311000L; i += 86400000) {
-            List<StationInfoHour> shs = new ArrayList<>();
-            for (String l : ls) {
-                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.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);
+                List<StationInfoHour> shs = new ArrayList<>();
+                for (String l : ls) {
+                    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.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();
+                }
             }
-            try {
-                boolean b = stationInfoHourService.saveBatch(shs);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
         }
 
     }
@@ -1584,7 +1626,7 @@ public class WindPowerInfo1Service {
         qw.lambda().eq(ProBaseBackfill::getType, "AI0001");
         List<ProBaseBackfill> backfills = iProBaseBackfillService.list(qw);
         List<ProEconEquipmentInfoJs> jss = new ArrayList<>();
-        String[] dateTime = { "2025-01-09"};
+        String[] dateTime = {"2025-01-09"};
         for (String s : dateTime) {
             LocalDate now = LocalDate.parse(s);
             QueryWrapper<ProEconEquipmentInfoJs> qw2 = new QueryWrapper<>();

+ 10 - 2
generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java

@@ -1747,6 +1747,14 @@ public class SaticSchedulePgTask {
 
     }
 
+    @XxlJob("report_ha_windturbine")
+    public void reportHaWindturbine() throws Exception {
+
+        Date date = new Date();
+        windPowerInfo1Service.writeHaWindturbine(date);
+
+    }
+
     /**
      * 一/二期风机运行参数
      */
@@ -1766,8 +1774,8 @@ public class SaticSchedulePgTask {
     public void reportInfo2() throws Exception {
 
         Date date = new Date();
-        windPowerInfo1Service.writeReport2(date);
-//        windPowerInfo1Service.writeReportHistory2(date);
+//        windPowerInfo1Service.writeReport2(date);
+        windPowerInfo1Service.writeReportHistory2(date);
 
     }
 

File diff suppressed because it is too large
+ 0 - 14
generationXK-service/src/main/resources/application-nxf.yml


+ 2 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -1652,7 +1652,7 @@ public class SpecificService {
             Date date = Date.from(instant);
             vo.setYear(DateUtils.getYear(date));
             vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue(), 2));
+            vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue()/1000, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -1663,7 +1663,7 @@ public class SpecificService {
 
             if (optional.isPresent()) {
                 StationInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue(), 2));
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue()/1000, 2));
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);