Browse Source

修改光伏从170取

xieshengjie 2 years ago
parent
commit
bfc3dff018

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

@@ -28,9 +28,12 @@ import java.util.*;
 public class EdosUtil implements IEdosUtil {
 
     private RestTemplate restTemplate =new RestTemplate();
-    @Value("${db.url}")
+    @Value("${db.url1}")
     private String baseURL;
 
+    @Value("${db.url2}")
+    private String baseURL2;
+
     @Value("${initialcode}")
     private String initialcode;
     @Override
@@ -91,6 +94,9 @@ public class EdosUtil implements IEdosUtil {
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point) && !initialcode.equals(point))
         {
             String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point + "&ts=" + date;
+            if(point.startsWith("GF-")){
+                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + point + "&ts=" + date;
+            }
 
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
             JSONObject jsonArray = resp.getBody();
@@ -148,7 +154,12 @@ public class EdosUtil implements IEdosUtil {
 
         if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getNemCode()) && !initialcode.equals(point.getNemCode()))
         {
-            String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + date;
+            String rawUrl = "";
+            if(point.getTypeId().equals("G")){
+                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + date;
+            }else {
+                rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + date;
+            }
 
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
             JSONObject jsonArray = resp.getBody();
@@ -308,6 +319,10 @@ public class EdosUtil implements IEdosUtil {
 
         long subTime =beginDate - pried;
         String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate ;
+        if (pointid.startsWith("GF-")){
+            rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate ;
+        }
+
         ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
         JSONObject jsonObjectSection = sectionResp.getBody();
         if (jsonObjectSection != null) {
@@ -417,7 +432,13 @@ public class EdosUtil implements IEdosUtil {
             Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
 
             try {
-                String url = baseURL + "/latest?null=0";
+                String url = "";
+                if (point.getTypeId().equals("G")){
+                    url = baseURL2 + "/latest?null=0";
+                }else {
+                    url = baseURL + "/latest?null=0";
+                }
+
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (keys.isPresent())
                     url = url + "&keys=" + keys.get();
@@ -482,7 +503,12 @@ public class EdosUtil implements IEdosUtil {
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
             try {
-                String url = baseURL + "/history/snap?null=0";
+                String url ="";
+                if (point.getTypeId().equals("G")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }else {
+                    url = baseURL + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -518,7 +544,12 @@ public class EdosUtil implements IEdosUtil {
                             //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
                             // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
                             // 则代表该时间节点快照有效,否则为0
+
                             String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            if (point.getTypeId().equals("G")){
+                                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            }
+
                             ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
                             JSONObject jsonObjectSection = sectionResp.getBody();
 
@@ -596,7 +627,12 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> startTs = Optional.ofNullable(beginDate);
             Optional<Long> endTs = Optional.ofNullable(endDate);
             try {
-                String url = baseURL + "/history/snap?null=0";
+                String url = "";
+                if (point.getTypeId().equals("G")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }else {
+                    url = baseURL + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -649,6 +685,10 @@ public class EdosUtil implements IEdosUtil {
         {
             Optional<String> keys = Optional.ofNullable(pointid);
             String url = baseURL + "/latest?null=0";
+            if (pointid.startsWith("GF-")){
+                url = baseURL2 + "/latest?null=0";
+            }
+
             try {
                 if (keys.isPresent())
                     url = url + "&keys=" + keys.get();
@@ -693,6 +733,9 @@ public class EdosUtil implements IEdosUtil {
         String pointIdString = StringUtil.join(pointids, ",");
         Optional<String> keys = Optional.ofNullable(pointIdString);
         String url = baseURL + "/latest?null=0";
+        if (pointIdString.startsWith("GF-")){
+            url = baseURL2 + "/latest?null=0";
+        }
         try {
             if (keys.isPresent())
                 url = url + "&keys=" + keys.get();
@@ -784,6 +827,9 @@ public class EdosUtil implements IEdosUtil {
         String pointIdString = StringUtil.join(pointids.toArray(), ",");
         Optional<String> keys = Optional.ofNullable(pointIdString);
         String url = baseURL + "/latest?null=0";
+        if (pointIdString.startsWith("GF-")){
+            url = baseURL2 + "/latest?null=0";
+        }
         try {
             if (keys.isPresent())
                 url = url + "&keys=" + keys.get();
@@ -886,6 +932,9 @@ public class EdosUtil implements IEdosUtil {
                 String pointIdString = StringUtil.join(pointids, ",");
                 Optional<String> keys = Optional.ofNullable(pointIdString);
                 String url = baseURL + "/latest?null=0";
+                if (pointIdString.startsWith("GF-")){
+                    url = baseURL2 + "/latest?null=0";
+                }
                 try {
                     if (keys.isPresent())
                         url = url + "&keys=" + keys.get();
@@ -975,6 +1024,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (pointid.startsWith("GF-")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1004,6 +1056,9 @@ public class EdosUtil implements IEdosUtil {
                             // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
                             // 则代表该时间节点快照有效,否则为0
                             String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() ;
+                            if (pointid.startsWith("GF-")){
+                                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() ;
+                            }
                             ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
                             JSONObject jsonObjectSection = sectionResp.getBody();
 
@@ -1082,7 +1137,11 @@ public class EdosUtil implements IEdosUtil {
             Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
 
             try {
+
                 String url = baseURL + "/history/raw?null=0";
+                if (pointid.startsWith("GF-")){
+                    url = baseURL2 + "/history/raw?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1149,7 +1208,12 @@ public class EdosUtil implements IEdosUtil {
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
 
             try {
-                String url = baseURL + "/history/stat?null=0";
+                String url = "";
+                if (point.getTypeId().equals("G")){
+                    url = baseURL2 + "/history/stat?null=0";
+                }else {
+                    url = baseURL + "/history/stat?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1285,6 +1349,9 @@ public class EdosUtil implements IEdosUtil {
             Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
             try {
                 String url = baseURL + "/history/stat?null=0";
+                if (pointid.startsWith("GF-")){
+                    url = baseURL2 + "/history/stat?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1338,6 +1405,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/stat?null=0";
+                if (point.startsWith("GF-")){
+                    url = baseURL2 + "/history/stat?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1425,6 +1495,9 @@ public class EdosUtil implements IEdosUtil {
     @Override
     public void updatePoint(PointData point) throws Exception {
         String url = baseURL + "/history";
+        if (point.getEdnaId().startsWith("GF-")){
+            url = baseURL2 + "/history";
+        }
         try {
             String result = restTemplate.postForObject(url, convertPointData(point), String.class);
         } catch (HttpClientErrorException exception) {
@@ -1687,6 +1760,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (pointid.startsWith("GF-")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1789,6 +1865,9 @@ public class EdosUtil implements IEdosUtil {
         Optional<String> tagName = Optional.ofNullable(tagNameString);
         Optional<Long> ts = Optional.ofNullable(time * 1000);
         String url = baseURL + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
+        if (tagNameString.startsWith("GF-")){
+            url = baseURL2 + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
+        }
         try {
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
             JSONObject jsonObject = resp.getBody();
@@ -1822,6 +1901,9 @@ public class EdosUtil implements IEdosUtil {
             Optional<String> tagName = Optional.ofNullable(tagNameString);
             Optional<Long> ts = Optional.ofNullable(time * 1000);
             String url = baseURL + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
+            if (id.startsWith("GF-")){
+                url = baseURL2 + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
+            }
             try {
                 ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
                 JSONObject jsonObject = resp.getBody();

+ 10 - 11
realtime/generationXK-service/src/main/resources/application-dev.yml

@@ -10,7 +10,7 @@ spring:
   #redis集群
   redis:
     #    host: 124.70.18.168
-    host: 10.153.172.65
+    host: 10.81.3.155
     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: 123456
+    password:
     application:
       name: test
     jedis:
@@ -28,13 +28,13 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 0
+    database: 9
   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://10.153.172.63:5432/IMS_NEM_SDL?rewriteBatchedStatements=true
+    url: jdbc:postgresql://10.81.3.151:5432/IMS_NEM_JN?rewriteBatchedStatements=true
     username: postgres
     password: postgres
     #    url: jdbc:postgresql://124.70.75.91:5432/jn_test
@@ -88,14 +88,13 @@ logging:
 #db url
 db:
   #  url: http://127.0.0.1:8011/ts
-  url: http://10.153.172.65:8011/ts
+  url1: http://localhost:8011/ts
+  url2: http://localhost:8011/ts
 #参与计算的场站
-#runWindpowerstation: SDL_SXNY_JNSS_FDC_STA
-runWindpowerstation: SDL_GDDL_QDJN_FDC_STA,SDL_GDDL_RZJX_FDC_STA,SDL_GDDL_W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STA,SD_GDDL_RZWL_FDC_STA
+#runWindpowerstation: SDL_GDDL_QDJN_FDC_STA,SDL_GDDL_RZJX_FDC_STA,SDL_GDDL_WHWD_FDC_STA,SDL_GDDL_WHXQ_FDC_STA,SDL_GDDL_RZWL_FDC_STA,SDL_GDDL_WFZC_FDC_STA,SDL_GDDL_DZXJF_FDC_STA,SDL_GDDL_DZXJS_FDC_STA,SDL_GDDL_XTTA_FDC_STA,SDL_LYDL_BEIH_FDC_STA,SDL_LYDL_BINH_FDC_STA,SDL_LYDL_CG_FDC_STA,SDL_LYDL_FJ_FDC_STA,SDL_LYDL_YS_FDC_STA,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: SXJ_KGDL_NJL_FDC_STA,SXJ_KGDL_YF_FDC_STA,SXJ_KGDL_YLZ_FDC_STA,SXJ_KGDL_XWT_FDC_STA,SXJ_KGDL_PTZ_FDC_STA,SXJ_KGDL_GJY_FDC_STA,SXJ_KGDL_BHB_FDC_STA,SXJ_KGDL_HSM_FDC_STA,SXJ_KGDL_YTY_FDC_STA,SXJ_KGDL_BHB3_FDC_STA,SXJ_KGDL_SY_GDC_STA,SXJ_KGDL_PDL_FDC_STA,SXJ_KGDL_ZK_FDC_STA
+runWindpowerstation: SXJ_KGDL_GJY_FDC_STA
 #判断数据终端
 second: 1800
 #判断降出力

+ 2 - 2
web/runeconomy-xk/src/main/resources/application.yml

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