Browse Source

计算服务修改

xieshengjie 2 years ago
parent
commit
083179f70a

+ 2 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java

@@ -18,7 +18,8 @@ import org.springframework.core.env.Environment;
 
 
 @Configuration
-@PropertySource("classpath:xxl-job-executorWP.properties")
+@PropertySource("classpath:xxl-job-executor.properties")
+//@PropertySource("classpath:xxl-job-executorWP.properties")
 //@PropertySource("classpath:xxl-job-executorRG.properties")
 public class XxlJobConfig implements EnvironmentAware {
     private Environment env;

+ 2 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CalculationService.java

@@ -40,7 +40,8 @@ public class CalculationService {
         Date monthFirst = DateUtils.getMonthFirst(currentDate);
         double hoursDiff = DateUtils.hoursDiff2(currentDate, monthFirst);
 
-        String toDate1 = DateUtils.toDate1(currentDate);
+
+        Date toDate1 = DateUtils.parseDate(DateUtils.toDate1(currentDate));
         Map<String,ProEconPowerstationInfoDay2> tempMap = new HashMap<>();
         QueryWrapper<ProEconPowerstationInfoDay2> qw = new QueryWrapper<>();
         qw.eq("record_date",toDate1);

+ 22 - 16
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/ElectricityMeteringService.java

@@ -203,37 +203,38 @@ public class ElectricityMeteringService {
             AtomicReference<Double> ncydl = new AtomicReference<>((double) 0);
             proBasicPros.stream().forEach(line->{    //期次
                 try {
-                    double linerfdl = getLineValue(line.getId(), ContantXk.RFDLSYZ, currentDate, linepointmap);
+                    double linerfdl = getLineValue(line.getId(), ContantXk.RFDLSYZ, currentDate, propointmap);
                     rfdl.updateAndGet(v -> new Double((double) (v + linerfdl)));
-                    double lineyfdl = getLineValue(line.getId(), ContantXk.YFDLSYZ, currentDate, linepointmap);
+                    double lineyfdl = getLineValue(line.getId(), ContantXk.YFDLSYZ, currentDate, propointmap);
                     yfdl.updateAndGet(v -> new Double((double) (v + lineyfdl)));
-                    double linenfdl = getLineValue(line.getId(), ContantXk.NFDLSYZ, currentDate, linepointmap);
+                    double linenfdl = getLineValue(line.getId(), ContantXk.NFDLSYZ, currentDate, propointmap);
                     nfdl.updateAndGet(v -> new Double((double) (v + linenfdl)));
-                    double linerswdl = getLineValue(line.getId(), ContantXk.RSWDL, currentDate, linepointmap);
+                    double linerswdl = getLineValue(line.getId(), ContantXk.RSWDL, currentDate, propointmap);
                     rswdl.updateAndGet(v -> new Double((double) (v + linerswdl)));
-                    double lineyswdl = getLineValue(line.getId(), ContantXk.YSWDL, currentDate, linepointmap);
+                    double lineyswdl = getLineValue(line.getId(), ContantXk.YSWDL, currentDate, propointmap);
                     yswdl.updateAndGet(v -> new Double((double) (v + lineyswdl)));
-                    double linenswdl = getLineValue(line.getId(), ContantXk.NSWDL, currentDate, linepointmap);
+                    double linenswdl = getLineValue(line.getId(), ContantXk.NSWDL, currentDate, propointmap);
                     nswdl.updateAndGet(v -> new Double((double) (v + linenswdl)));
-                    double linergwgwdl = getLineValue(line.getId(), ContantXk.RGWGWDL, currentDate, linepointmap);
+                    double linergwgwdl = getLineValue(line.getId(), ContantXk.RGWGWDL, currentDate, propointmap);
                     rgwgwdl.updateAndGet(v -> new Double((double) (v + linergwgwdl)));
-                    double lineygwgwdl = getLineValue(line.getId(), ContantXk.YGWGWDL, currentDate, linepointmap);
+                    double lineygwgwdl = getLineValue(line.getId(), ContantXk.YGWGWDL, currentDate, propointmap);
                     ygwgwdl.updateAndGet(v -> new Double((double) (v + lineygwgwdl)));
-                    double linengwgwdl = getLineValue(line.getId(), ContantXk.NGWGWDL, currentDate, linepointmap);
+                    double linengwgwdl = getLineValue(line.getId(), ContantXk.NGWGWDL, currentDate, propointmap);
                     ngwgwdl.updateAndGet(v -> new Double((double) (v + linengwgwdl)));
-                    double linernwgwdl = getLineValue(line.getId(), ContantXk.RNWGWDL, currentDate, linepointmap);
+                    double linernwgwdl = getLineValue(line.getId(), ContantXk.RNWGWDL, currentDate, propointmap);
                     rnwgwdl.updateAndGet(v -> new Double((double) (v + linernwgwdl)));
-                    double lineynwgwdl = getLineValue(line.getId(), ContantXk.YNWGWDL, currentDate, linepointmap);
+                    double lineynwgwdl = getLineValue(line.getId(), ContantXk.YNWGWDL, currentDate, propointmap);
                     ynwgwdl.updateAndGet(v -> new Double((double) (v + lineynwgwdl)));
-                    double linennwgwdl = getLineValue(line.getId(), ContantXk.NNWGWDL, currentDate, linepointmap);
+                    double linennwgwdl = getLineValue(line.getId(), ContantXk.NNWGWDL, currentDate, propointmap);
                     nnwgwdl.updateAndGet(v -> new Double((double) (v + linennwgwdl)));
-                    double linercydl = getLineValue(line.getId(), ContantXk.RCYDL, currentDate, linepointmap);
+                    double linercydl = getLineValue(line.getId(), ContantXk.RCYDL, currentDate, propointmap);
                     rcydl.updateAndGet(v -> new Double((double) (v + linercydl)));
-                    double lineycydl = getLineValue(line.getId(), ContantXk.YCYDL, currentDate, linepointmap);
+                    double lineycydl = getLineValue(line.getId(), ContantXk.YCYDL, currentDate, propointmap);
                     ycydl.updateAndGet(v -> new Double((double) (v + lineycydl)));
-                    double linencydl = getLineValue(line.getId(), ContantXk.NCYDL, currentDate, linepointmap);
+                    double linencydl = getLineValue(line.getId(), ContantXk.NCYDL, currentDate, propointmap);
                     ncydl.updateAndGet(v -> new Double((double) (v + linencydl)));
                 } catch (Exception e) {
+
                     e.printStackTrace();
                 }
             });
@@ -278,7 +279,12 @@ public class ElectricityMeteringService {
     }
 
     private double getLineValue(String lineid, String uniformcode, Date currentDate, Map<String, Map<String, ProBasicPowerstationPoint>> linepointmap) throws Exception {
-        ProBasicPowerstationPoint proBasicWppoint = linepointmap.get(lineid).get(uniformcode);
+        ProBasicPowerstationPoint proBasicWppoint = null;
+        try{
+            proBasicWppoint = linepointmap.get(lineid).get(uniformcode);
+        }catch (Exception e){
+            linepointmap.get(lineid).get(uniformcode);
+        }
         return edosUtil.getSectionData(proBasicWppoint,currentDate.getTime()).getPointValueInDouble();
     }
 

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/RegionCalService.java

@@ -3035,7 +3035,7 @@ public class RegionCalService {
         Date monthFirst = DateUtils.getMonthFirst(currentDate);
         double hoursDiff = DateUtils.hoursDiff2(currentDate, monthFirst);
 
-        String toDate1 = DateUtils.toDate1(currentDate);
+        Date toDate1 = DateUtils.parseDate(DateUtils.toDate1(currentDate));
         Map<String, ProEconPowerstationInfoDay2> tempMap = new HashMap<>();
         QueryWrapper<ProEconPowerstationInfoDay2> qw = new QueryWrapper<>();
         qw.eq("record_date",toDate1);

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -1415,7 +1415,7 @@ public class EdosUtil implements IEdosUtil {
         JSONObject jo = new JSONObject();
         jo.put("tagName", pd.getEdnaId());
         JSONObject joo = new JSONObject();
-        joo.put("ts", pd.getPointTime()*1000);
+        joo.put("ts", pd.getPointTime());
         joo.put("status", 0);
         joo.put("doubleValue", pd.getPointValueInDouble());
         jo.put("tsData", joo);

+ 2 - 2
realtime/generationXK-service/src/main/resources/application-xk.yml

@@ -91,8 +91,8 @@ db:
   url: http://192.168.11.250:8011/ts
   #url: http://124.70.75.91:8011/ts
 #参与计算的场站
-#runWindpowerstation: SD_GDDL_RZLX_FDC_STA,SD_GDDL_QDJN_FDC_STA,SD_GDDL_WHWD_FDC_STA,SD_GDDL_WHXQ_FDC_STA,SD_GDDL_RZWL_FDC_STA,SD_GDDL_WFZC_FDC_STA,SD_GDDL_DZXJ_FDC_STA,SD_GDDL_XTTA_FDC_STA,SD_GDDL_BH1_FDC_STA,SD_GDDL_BH2_FDC_STA,SD_GDDL_CG_FDC_STA,SD_GDDL_FJ_FDC_STA,SD_GDDL_YS_FDC_STA,SD_GDDL_FXFC_FDC_STA,SD_GDDL_JNSS_FDC_STA,SD_GDDL_WFBH_FDC_STA,SD_GDDL_PLHS_FDC_STA,SD_GDDL_JNCQ_FDC_STA,SD_GDDL_LXLN_FDC_STA,SD_GDDL_LQJS_FDC_STA,SD_GDDL_ZYXD_FDC_STA,SD_GDDL_ZYFS_FDC_STA
-runWindpowerstation: SD_GDDL_RZLX_FDC_STA
+runWindpowerstation: SD_GDDL_RZLX_FDC_STA,SD_GDDL_QDJN_FDC_STA,SD_GDDL_WHWD_FDC_STA,SD_GDDL_WHXQ_FDC_STA,SD_GDDL_RZWL_FDC_STA,SD_GDDL_WFZC_FDC_STA,SD_GDDL_DZXJ_FDC_STA,SD_GDDL_XTTA_FDC_STA,SD_GDDL_BH1_FDC_STA,SD_GDDL_BH2_FDC_STA,SD_GDDL_CG_FDC_STA,SD_GDDL_FJ_FDC_STA,SD_GDDL_YS_FDC_STA,SD_GDDL_FXFC_FDC_STA,SD_GDDL_JNSS_FDC_STA,SD_GDDL_WFBH_FDC_STA,SD_GDDL_PLHS_FDC_STA,SD_GDDL_JNCQ_FDC_STA,SD_GDDL_LXLN_FDC_STA,SD_GDDL_LQJS_FDC_STA,SD_GDDL_ZYXD_FDC_STA,SD_GDDL_ZYFS_FDC_STA,SD_GHTZ_HZJ_GDC_STA
+#runWindpowerstation: SD_GDDL_RZLX_FDC_STA
 #计算状态用ai或者di
 clauStatus:
   ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次

+ 2 - 2
realtime/generationXK-service/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-#    active: xk
-    active: yun
+    active: xk
+#    active: yun
 
 #    active: td

+ 26 - 0
realtime/generationXK-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -44,6 +44,10 @@ public class GenerationTest {
     private RegionCalreService regionCalreService;
     @Resource
     private RegionCalService regionCalService;
+    @Resource
+    private AccessStatusService accessStatusService;
+    @Resource
+    private CalculationService calculationService;
 
     @Test
     public void test1() throws Exception {
@@ -70,5 +74,27 @@ public class GenerationTest {
 
     @Test
     public void test3() throws Exception {
+//        //场站接入状态,总预测功率
+//        accessStatusService.accessStatus();
+//        //全场状态
+//        accessStatusService.fullFieldState();
+
+
+//                statusService.powerRationing();
+//        statusService.statusReal();
+//        statusService.calculateStatusNumber();
+
+//         realtimeService.savaRealtimeTarget();
+//        cycleCalculationService.saveCyle();
+
+//        electricityMeteringService.saveGenerationDatas();
+
+//        calculationService.calWp();
+
+        regionCalService.companyCal();
+        regionCalService.RegionCal();
+
+        regionCalreService.companyCal();
+        regionCalreService.RegionCal();
     }
 }