Parcourir la source

修改光伏场站点采用单独适配器

xieshengjie il y a 1 an
Parent
commit
983adaa4bb

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

@@ -48,6 +48,9 @@ public class EdosUtil implements IEdosUtil {
                 Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
 
                 String url = baseURL + "/latest?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url =  baseURL2 + "/latest?null=0";
+                }
                 if (keys.isPresent())
                     url = url + "&keys=" + keys.get();
                 if (thingType.isPresent())
@@ -125,7 +128,9 @@ 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;
-
+            if (point.getNemCode().startsWith("GF-")){
+                rawUrl =  baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + date;
+            }
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
             JSONObject jsonArray = resp.getBody();
             if (StringUtils.isNotEmpty(jsonArray)){
@@ -206,6 +211,10 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url =  baseURL2 + "/history/snap?null=0";
+                }
+
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -243,6 +252,9 @@ public class EdosUtil implements IEdosUtil {
                             // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
                             // 则代表该时间节点快照有效,否则为0
                             String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            if (point.getNemCode().startsWith("GF-")){
+                                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            }
                             ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
                             JSONObject jsonObjectSection = sectionResp.getBody();
 
@@ -375,6 +387,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1283,6 +1298,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/stat?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url = baseURL2 + "/history/stat?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();

+ 19 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/util/realtimesource/EdosUtil.java

@@ -48,6 +48,9 @@ public class EdosUtil implements IEdosUtil {
                 Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
 
                 String url = baseURL + "/latest?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url =  baseURL2 + "/latest?null=0";
+                }
                 if (keys.isPresent())
                     url = url + "&keys=" + keys.get();
                 if (thingType.isPresent())
@@ -125,7 +128,9 @@ 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;
-
+            if (point.getNemCode().startsWith("GF-")){
+                rawUrl =  baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + date;
+            }
             ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
             JSONObject jsonArray = resp.getBody();
             if (StringUtils.isNotEmpty(jsonArray)){
@@ -206,6 +211,10 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url =  baseURL2 + "/history/snap?null=0";
+                }
+
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -243,6 +252,9 @@ public class EdosUtil implements IEdosUtil {
                             // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
                             // 则代表该时间节点快照有效,否则为0
                             String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            if (point.getNemCode().startsWith("GF-")){
+                                rawUrl = baseURL2 + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() ;
+                            }
                             ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
                             JSONObject jsonObjectSection = sectionResp.getBody();
 
@@ -375,6 +387,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/snap?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url = baseURL2 + "/history/snap?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();
@@ -1283,6 +1298,9 @@ public class EdosUtil implements IEdosUtil {
 
             try {
                 String url = baseURL + "/history/stat?null=0";
+                if (point.getNemCode().startsWith("GF-")){
+                    url = baseURL2 + "/history/stat?null=0";
+                }
                 //tagName 或thingType,thingId,uniformCode可以确定一个标签点
                 if (tagName.isPresent())
                     url = url + "&tagName=" + tagName.get();