瀏覽代碼

问题修复

xieshengjie 2 年之前
父節點
當前提交
433fdefd5d

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

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

+ 17 - 12
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/ElectricityMeteringService.java

@@ -59,7 +59,7 @@ public class ElectricityMeteringService {
             //线路发电量
             log.info(line.getName()+"电计量电量计算开始!");
             Optional<ProBasicMeterPoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineId().equals(line.getId()) &&   me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("进线") && me.getMeterSort().equals("主")).findFirst();
-            getLineFdl(samedayZero, monthFirstZero, yearFirstZero, date,currentDate, lineResultList, proBasicWppointMap, fdlOptional);
+            getLineFdl(line.getId(),samedayZero, monthFirstZero, yearFirstZero, date,currentDate, lineResultList, proBasicWppointMap, fdlOptional);
             log.info(line.getName()+"电计量电量计算完毕!");
 
             //线路上网电量
@@ -147,8 +147,8 @@ public class ElectricityMeteringService {
             proResultList.add(PointUtil.createPointData(date,rfdl.get(),rfdlpoint.getNemCode(),rfdlpoint.getName()));
             ProBasicPowerstationPoint yfdlpoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
             proResultList.add(PointUtil.createPointData(date,yfdl.get(),yfdlpoint.getNemCode(),yfdlpoint.getName()));
-            ProBasicPowerstationPoint nfdlpoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
-            proResultList.add(PointUtil.createPointData(date,nfdl.get(),yfdlpoint.getNemCode(),nfdlpoint.getName()));
+            ProBasicPowerstationPoint nfdlpoint = proBasicWppointMap.get(ContantXk.NFDLSYZ);
+            proResultList.add(PointUtil.createPointData(date,nfdl.get(),nfdlpoint.getNemCode(),nfdlpoint.getName()));
 
             ProBasicPowerstationPoint rswdlpoint = proBasicWppointMap.get(ContantXk.RSWDL);
             proResultList.add(PointUtil.createPointData(date,rswdl.get(),rswdlpoint.getNemCode(),rswdlpoint.getName()));
@@ -242,8 +242,8 @@ public class ElectricityMeteringService {
             wpResultList.add(PointUtil.createPointData(date,rfdl.get(),rfdlpoint.getNemCode(),rfdlpoint.getName()));
             ProBasicPowerstationPoint yfdlpoint = wpBasicWppointMap.get(ContantXk.YFDLSYZ);
             wpResultList.add(PointUtil.createPointData(date,yfdl.get(),yfdlpoint.getNemCode(),yfdlpoint.getName()));
-            ProBasicPowerstationPoint nfdlpoint = wpBasicWppointMap.get(ContantXk.YFDLSYZ);
-            wpResultList.add(PointUtil.createPointData(date,nfdl.get(),yfdlpoint.getNemCode(),nfdlpoint.getName()));
+            ProBasicPowerstationPoint nfdlpoint = wpBasicWppointMap.get(ContantXk.NFDLSYZ);
+            wpResultList.add(PointUtil.createPointData(date,nfdl.get(),nfdlpoint.getNemCode(),nfdlpoint.getName()));
 
             ProBasicPowerstationPoint rswdlpoint = wpBasicWppointMap.get(ContantXk.RSWDL);
             wpResultList.add(PointUtil.createPointData(date,rswdl.get(),rswdlpoint.getNemCode(),rswdlpoint.getName()));
@@ -322,13 +322,15 @@ public class ElectricityMeteringService {
             if (StringUtils.isEmpty(fdlList)){
                 String[] lines = swdlMeterpoint.getLineId().split("\\|");
                 Arrays.stream(lines).forEach(l->{
-                    getLineFdl(samedayZero, monthFirstZero, yearFirstZero, date,currentDate, fdlList, proBasicWppointMap, fdlOptional);
+                    Optional<ProBasicMeterPoint> fdOptional = CacheContext.meterpoints.stream().filter(me -> me.getLineId().equals(l) &&   me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("进线") && me.getMeterSort().equals("主")).findFirst();
+
+                    getLineFdl(l,samedayZero, monthFirstZero, yearFirstZero, date,currentDate, fdlList, proBasicWppointMap, fdOptional);
                 });
             }
             //获取电量百分比,算其他电量
             Map<String, Double> percentageMap = getPercentage(fdlList,swdlMeterpoint,linepointmap, line);
 
-            String pointid = swdlMeterpoint.getId();
+            String pointid = swdlMeterpoint.getNemCode();
             Double real = 0.0;
             Double sameday = 0.0;
             Double month = 0.0;
@@ -365,10 +367,10 @@ public class ElectricityMeteringService {
         }
     }
 
-    private void getLineFdl(Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date date,Date currentDate, List<PointData> lineResultList, Map<String, ProBasicPowerstationPoint> proBasicWppointMap, Optional<ProBasicMeterPoint> fdlOptional) {
+    private void getLineFdl(String line,Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date date,Date currentDate, List<PointData> lineResultList, Map<String, ProBasicPowerstationPoint> proBasicWppointMap, Optional<ProBasicMeterPoint> fdlOptional) {
         if (fdlOptional.isPresent()){
             ProBasicMeterPoint proBasicMeterPoint = fdlOptional.get();
-            String pointid = proBasicMeterPoint.getId();
+            String pointid = proBasicMeterPoint.getNemCode();
             Double real = 0.0;
             Double sameday = 0.0;
             Double month = 0.0;
@@ -381,19 +383,22 @@ public class ElectricityMeteringService {
 
                 Double magnification = fdlOptional.get().getMagnification();
                 Double xs = proBasicMeterPoint.getXs();
+
+                Map<String, ProBasicPowerstationPoint> powerstationPointMap = CacheContext.linepointmap.get(line);
+
                 //线路日发电量
                 double xlrfdl = (real - sameday) * magnification / xs;
-                ProBasicPowerstationPoint rpoint = proBasicWppointMap.get(ContantXk.RFDLSYZ);
+                ProBasicPowerstationPoint rpoint = powerstationPointMap.get(ContantXk.RFDLSYZ);
                 PointData r = PointUtil.createPointData(date, xlrfdl, rpoint.getNemCode(),rpoint.getName());
                 lineResultList.add(r);
                 //线路月发电量
                 double xlyfdl = (real - month) * magnification / xs;
-                ProBasicPowerstationPoint ypoint = proBasicWppointMap.get(ContantXk.YFDLSYZ);
+                ProBasicPowerstationPoint ypoint = powerstationPointMap.get(ContantXk.YFDLSYZ);
                 PointData y = PointUtil.createPointData(date, xlyfdl,ypoint.getNemCode(),ypoint.getName());
                 lineResultList.add(y);
                 //线路年发电量
                 double xlnfdl = (real - year) * magnification / xs;
-                ProBasicPowerstationPoint npoint = proBasicWppointMap.get(ContantXk.NFDLSYZ);
+                ProBasicPowerstationPoint npoint = powerstationPointMap.get(ContantXk.NFDLSYZ);
                 PointData n = PointUtil.createPointData(date, xlnfdl,npoint.getNemCode(),npoint.getName());
                 lineResultList.add(n);
             } catch (Exception e) {

+ 162 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/StatusService.java

@@ -871,7 +871,169 @@ public class StatusService {
                         mxstatus = 2.0;
                 }
             }
+        }else if (windturbineManufacturerId.equals("LHDL_MF") && wt.getRegionId().equals("SDL_RGN")){
+            //多状态根据一个点来判断
+            Optional<ProBasicStatusPoint> first = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.AI422)).findFirst();
+            if (first.isPresent()){
+                ProBasicStatusPoint windturbinestatusdi = first.get();
+
+                int pointValueInDouble = (int) edosUtil.getRealData(windturbinestatusdi.getNemCode()).getPointValueInDouble();
+                switch (pointValueInDouble){
+                    //待机
+                    case 1:
+                    case 2:
+                    case 16:
+                    case 128:
+                    case 256:
+                    case 1024:
+                        mxstatus = 0.0;
+                        break;
+                    case 4:
+                        //故障
+                        mxstatus = 4.0;
+                        break;
+                    case 8:
+                        //维护
+                        mxstatus = 6.0;
+                        break;
+                    case 32://限电
+                        mxstatus = 8.0;
+                        break;
+                    case 64:
+                    case 512://运行
+                        mxstatus = 2.0;
+                        break;
+                    default:
+                        mxstatus = 2.0;
+                }
+            }
+        }else if (windturbineManufacturerId.equals("SHDQ_MF")){   //山东
+            //多状态根据一个点来判断
+            Optional<ProBasicStatusPoint> first = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.AI422)).findFirst();
+            if (first.isPresent()){
+                ProBasicStatusPoint windturbinestatusdi = first.get();
+
+                int pointValueInDouble = (int) edosUtil.getRealData(windturbinestatusdi.getNemCode()).getPointValueInDouble();
+                switch (pointValueInDouble){
+                    //待机
+                    case 0:
+                    case 3:
+                    case 4:
+                    case 5:
+                    case 6:
+                    case 9:
+                        mxstatus = 0.0;
+                        break;
+                    case 1:
+                        //故障
+                        mxstatus = 4.0;
+                        break;
+                    case 2:
+                        //维护
+                        mxstatus = 6.0;
+                        break;
+                    case 12://限电
+                        mxstatus = 8.0;
+                        break;
+                    case 7:
+                    case 8://运行
+                    case 11:
+                        mxstatus = 2.0;
+                        break;
+                    default:
+                        mxstatus = 2.0;
+                }
+            }
+        }else if (windturbineManufacturerId.equals("SYHC_MF")){   //山东
+            //多状态根据一个点来判断
+            Optional<ProBasicStatusPoint> first = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.AI422)).findFirst();
+            if (first.isPresent()){
+                ProBasicStatusPoint windturbinestatusdi = first.get();
+
+                int pointValueInDouble = (int) edosUtil.getRealData(windturbinestatusdi.getNemCode()).getPointValueInDouble();
+                switch (pointValueInDouble){
+                    //待机
+                    case 1:
+                    case 3:
+                    case 4:
+                    case 5:
+                    case 6:
+                    case 9:
+                    case 10:
+                    case 11:
+                    case 12:
+                    case 21:
+                    case 22:
+                    case 23:
+                    case 24:
+                    case 25:
+                    case 26:
+                    case 27:
+                    case 50:
+                    case 99:
+                    case 200:
+                        mxstatus = 0.0;
+                        break;
+                    case 30:
+                        //手动停机
+                        mxstatus = 1.0;
+                    case 199:
+                        //故障
+                        mxstatus = 4.0;
+                        break;
+                    case 2:
+                        //维护
+                        mxstatus = 6.0;
+                        break;
+                    case 0://
+                        mxstatus = 12.0;
+                        break;
+                    case 7:
+                    case 8://运行
+                        mxstatus = 2.0;
+                        break;
+                    default:
+                        mxstatus = 2.0;
+                }
+            }
         }else if (windturbineManufacturerId.equals("LHDL_MF")){//联合动力
+
+            Optional<ProBasicStatusPoint> first = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.AI422)).findFirst();
+            if(first.isPresent()){
+                ProBasicStatusPoint windturbinestatusdi = first.get();
+
+                int pointValueInDouble = (int) edosUtil.getRealData(windturbinestatusdi.getNemCode()).getPointValueInDouble();
+                switch (pointValueInDouble){
+                    case 1:
+                    case 3:
+                    case 4:
+                        mxstatus = 1.0;
+                        break;
+                    case 2:
+                    case 10:
+                        mxstatus = 4.0;
+                        break;
+                    case 5:
+                    case 6:
+                        mxstatus = 2.0;
+                        break;
+                    case 7:
+                        mxstatus = 8.0;
+                        break;
+                    case 8:
+                        mxstatus = 13.0;
+                        break;
+                    case 9:
+                        mxstatus = 0.0;
+                        break;
+                    case 11:
+                    case 12:
+                        mxstatus = 6.0;
+                        break;
+                    default:
+                        mxstatus = 2.0;
+                }
+            }
             //每个状态一个状态点
             List<ProBasicStatusPoint> windturbinestatusdis = statusMap.get(wt.getId()).stream().filter(w -> w.getUniformCode().equals(Contant.MX000) || w.getUniformCode().equals(Contant.MX002) || w.getUniformCode().equals(Contant.MX004) || w.getUniformCode().equals(Contant.MX006) || w.getUniformCode().equals(Contant.MX008)).collect(Collectors.toList());
             for(ProBasicStatusPoint w : windturbinestatusdis){

+ 9 - 8
realtime/generationXK-service/src/main/resources/application-xny.yml

@@ -10,7 +10,7 @@ spring:
   #redis集群
   redis:
     #host: 127.0.0.1
-    host: 192.168.11.250
+    host: 10.153.172.65
     port: 6379
     timeout: 100000
     #    集群环境打开下面注释,单机不需要打开
@@ -19,7 +19,7 @@ spring:
     #      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
     #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
     #      maxRedirects: 3
-    password:
+    password: 123456
     application:
       name: test
     jedis:
@@ -28,13 +28,13 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 9
+    database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://192.168.11.248:5432/IMS_NEM_SD?rewriteBatchedStatements=true
+    url: jdbc:postgresql://10.153.172.63:5432/IMS_NEM_SDL?rewriteBatchedStatements=true
     username: postgres
     password: postgres
     #    url: jdbc:postgresql://124.70.75.91:5432/jn_test?rewriteBatchedStatements=true
@@ -87,13 +87,14 @@ logging:
     com.example: debug
 #db url
 db:
-  #url: http://127.0.0.1:8011/ts
-  url: http://192.168.11.250:8011/ts
+  url: http://10.153.172.65:8011/ts
+  #url: http://192.168.11.250:8011/ts
   #url: http://124.70.75.91:8011/ts
 #参与计算的场站
 #runWindpowerstation: SD_GDDL_WHWD_FDC_STA,SD_GDDL_WHXQ_FDC_STA,SD_GDDL_RZLX_FDC_STA,SD_GDDL_QDJN_FDC_STA,SD_SXNY_FXFC_FDC_STA,SD_SXNY_LXLN_FDC_STA,SD_SXNY_LQJS_FDC_STA,SD_SXNY_ZYFS_FDC_STA,SD_LYDL_BH2_FDC_STA,SD_GDDL_RZWL_FDC_STA,SD_SXNY_PLHS_FDC_STA,SD_SXNY_ZYXD_FDC_STA,SD_GDDL_DZXJ_FDC_STA,SD_GDDL_XTTA_FDC_STA,SD_GDDL_WFZC_FDC_STA,SD_SXNY_JNSS_FDC_STA,SD_SXNY_WFBH_FDC_STA,SD_LYDL_CG_FDC_STA,SD_LYDL_FJ_FDC_STA,SD_LYDL_YS_FDC_STA,SD_SXNY_JNCQ_FDC_STA,SD_LYDL_BH1_FDC_STA,SD_GHTZ_HZJ_GDC_STA
-runWindpowerstation: SD_GDDL_WHWD_FDC_STA
-
+#runWindpowerstation: HNX_SXNY_FRS_FDC_STA,HNX_SXNY_HJL_FDC_STA,HNX_SXNY_FL_FDC_STA
+#runWindpowerstation: SDL_SXNY_FXFC_FDC_STA,SDL_SXNY_JNSS_FDC_STA,SDL_SXNY_WFBH_FDC_STA,SDL_SXNY_PLHS_FDC_STA,SDL_SXNY_JNCQ_FDC_STA,SDL_SXNY_LQJS_FDC_STA,SDL_SXNY_ZYXD_FDC_STA,SDL_SXNY_ZYFS_FDC_STA,SDL_SXNY_LYJN_FDC_STA
+runWindpowerstation: SDL_SXNY_JNSS_FDC_STA
 #判断数据终端
 second: 1800
 #判断降出力

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

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

+ 10 - 8
realtime/generationXK-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -60,16 +60,18 @@ public class GenerationTest {
 
     @Test
     public void test2() throws Exception {
+
+//        electricityMeteringService.saveGenerationDatas();
 //        realtimeService.savaRealtimeTarget();
 //        cycleCalculationService.saveCyle();
 //        statusService.powerRationing();
-//        statusService.statusReal();
+        statusService.statusReal();
 //        statusService.calculateStatusNumber();
-        regionCalService.companyCal();
-        regionCalService.RegionCal();
-
-        regionCalreService.companyCal();
-        regionCalreService.RegionCal();
+//        regionCalService.companyCal();
+//        regionCalService.RegionCal();
+//
+//        regionCalreService.companyCal();
+//        regionCalreService.RegionCal();
 
 
     }
@@ -86,8 +88,8 @@ public class GenerationTest {
 //        statusService.statusReal();
 //        statusService.calculateStatusNumber();
 
-          realtimeService.savaRealtimeTarget();
-//        cycleCalculationService.saveCyle();
+//          realtimeService.savaRealtimeTarget();
+        cycleCalculationService.saveCyle();
 
 //        electricityMeteringService.saveGenerationDatas();