浏览代码

修改光伏从170取

xieshengjie 2 年之前
父节点
当前提交
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


+ 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