xujuanning 2 ay önce
ebeveyn
işleme
0d36fcda42

+ 1 - 1
data-adapter/src/main/java/com/gyee/dataadapter/config/DataConverterManager2.java

@@ -76,7 +76,7 @@ public class DataConverterManager2 {
         // 点名长度
         int pnameLen = getUshort();
         String pname = getString(pnameLen);
-        //pi.setTagName(pname);
+        pi.setTagName(pname);
         // 值类型
         byte vtype = getByte();
         //pi.setValueType(vtype);

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

@@ -63,7 +63,7 @@ public class AccessStatusService {
             double czzt = 0;
 
             double zycgl = 0;
-            Optional<ProBasicMeterPoint> swdlOptional = meterpoints.stream().filter(me -> me.getWindpowerstationId().equals(wp.getId()) && me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("出线") && me.getMeterSort().equals("主")).findFirst();
+            Optional<ProBasicMeterPoint> swdlOptional = meterpoints.stream().filter(me -> me.getWindpowerstationId().equals(wp.getId()) && "ZXYG".equals(me.getUniformCode()) && "出线".equals(me.getMeterType()) && "主".equals(me.getMeterSort())).findFirst();
             Optional<ProBasicSubStation> subStationOptional = subwpls.stream().filter(sub -> sub.getWindpowerstationId().equals(wp.getId())).findFirst();
             Optional<ProBasicWeatherStation> wsOptional = wswpls.stream().filter(ws -> ws.getWindpowerstationId().equals(wp.getId())).findFirst();
             List<ProBasicSubStation> stations = subwpls.stream().filter(sub -> sub.getWindpowerstationId().equals(wp.getId())).collect(Collectors.toList());

+ 123 - 90
generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -455,57 +455,78 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
+//    @Override
+//    public PointData getRealData(ProBasicEquipmentPoint point) throws Exception {
+//
+//        if (StringUtils.notEmp(point) && StringUtils.notEmp(point.getNemCode()) && !initialcode.equals(point.getNemCode())) {
+//            Optional<String> keys = Optional.ofNullable(point.getNemCode());
+//            Optional<String> thingType = Optional.ofNullable(point.getModelId());
+//            Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationId());
+//            Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
+//
+//            try {
+//                String url = "";
+//                if (point.getNemCode().startsWith("GF-")) {
+//                    url = baseURL2 + "/latest?null=0";
+//                } else {
+//                    url = baseURL + "/latest?null=0";
+//                }
+//
+//                //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+//                if (keys.isPresent())
+//                    url = url + "&keys=" + keys.get();
+//                else {
+//                    if (thingType.isPresent())
+//                        url = url + "&thingType=" + thingType.get();
+//                    if (thingId.isPresent())
+//                        url = url + "&thingId=" + thingId.get();
+//                    if (uniformCodes.isPresent())
+//                        url = url + "&uniformCodes=" + uniformCodes.get();
+//                }
+//                ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+//                JSONObject jsonArray = resp.getBody();
+//                if (StringUtils.isNotEmpty(jsonArray)) {
+//                    List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+//                    if (list.size() > 0) {
+//                        PointData po = list.get(0);
+//                        po.setPointValueInDouble(StringUtils.round(po.getPointValueInDouble(), 4));
+//                        return po;
+//                    } else {
+//                        return ErrorRequest.RequestError(point.getNemCode());
+//                    }
+//                } else {
+//                    return ErrorRequest.RequestError(point.getNemCode());
+//                }
+//
+//            } catch (HttpClientErrorException exception) {
+//                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+//                    //System.out.println("404请求错误");
+//                    return ErrorRequest.RequestError(point.getNemCode());
+//                } else {
+//                    throw exception;
+//                }
+//            }
+//        } else {
+//            PointData po = new PointData();
+//            po.setEdnaId(point.getNemCode());
+//            po.setPointValueInDouble(0.0);
+//            po.setPointTime(0l);
+//            return po;
+//        }
+//
+//    }
+
+
+
     @Override
     public PointData getRealData(ProBasicEquipmentPoint point) throws Exception {
 
         if (StringUtils.notEmp(point) && StringUtils.notEmp(point.getNemCode()) && !initialcode.equals(point.getNemCode())) {
             Optional<String> keys = Optional.ofNullable(point.getNemCode());
-            Optional<String> thingType = Optional.ofNullable(point.getModelId());
-            Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationId());
-            Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
-
-            try {
-                String url = "";
-                if (point.getNemCode().startsWith("GF-")) {
-                    url = baseURL2 + "/latest?null=0";
-                } else {
-                    url = baseURL + "/latest?null=0";
-                }
-
-                //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (keys.isPresent())
-                    url = url + "&keys=" + keys.get();
-                else {
-                    if (thingType.isPresent())
-                        url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
-                        url = url + "&thingId=" + thingId.get();
-                    if (uniformCodes.isPresent())
-                        url = url + "&uniformCodes=" + uniformCodes.get();
-                }
-                ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
-                JSONObject jsonArray = resp.getBody();
-                if (StringUtils.isNotEmpty(jsonArray)) {
-                    List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                    if (list.size() > 0) {
-                        PointData po = list.get(0);
-                        po.setPointValueInDouble(StringUtils.round(po.getPointValueInDouble(), 4));
-                        return po;
-                    } else {
-                        return ErrorRequest.RequestError(point.getNemCode());
-                    }
-                } else {
-                    return ErrorRequest.RequestError(point.getNemCode());
-                }
-
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    //System.out.println("404请求错误");
-                    return ErrorRequest.RequestError(point.getNemCode());
-                } else {
-                    throw exception;
-                }
-            }
+            List<String> ls = new ArrayList<>();
+            ls.add(String.valueOf(keys));
+            List<PointData> realData = getRealData(ls);
+            return realData.get(0);
         } else {
             PointData po = new PointData();
             po.setEdnaId(point.getNemCode());
@@ -516,6 +537,7 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
+
     @Override
     public List<PointData> getHistoryDatasSnap(ProBasicEquipmentPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
@@ -653,55 +675,66 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-    @Override
-    public PointData getRealData(String pointid) throws Exception {
-
-        if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
-            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();
-                else
-                    return null;
+//    @Override
+//    public PointData getRealData(String pointid) throws Exception {
+//
+//        if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
+//            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();
+//                else
+//                    return null;
+//
+//                ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+//                JSONObject jsonArray = resp.getBody();
+//                if (StringUtils.isNotEmpty(jsonArray)) {
+//                    List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+//                    if (list.size() > 0) {
+//                        PointData po = list.get(0);
+//                        po.setPointValueInDouble(StringUtils.round(po.getPointValueInDouble(), 4));
+//                        return po;
+//                    } else {
+//                        return ErrorRequest.RequestError(pointid);
+//                    }
+//                } else {
+//                    return ErrorRequest.RequestError(pointid);
+//                }
+//
+//            } catch (HttpClientErrorException exception) {
+//                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+//                    //System.out.println("404请求错误");
+//                    return ErrorRequest.RequestError(pointid);
+//                } else {
+//                    return ErrorRequest.RequestError(pointid);
+//                }
+//            }
+//        } else {
+//            PointData po = new PointData();
+//            po.setEdnaId(pointid);
+//            po.setPointValueInDouble(0.0);
+//            po.setPointTime(0l);
+//            return po;
+//        }
+//
+//    }
 
-                ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
-                JSONObject jsonArray = resp.getBody();
-                if (StringUtils.isNotEmpty(jsonArray)) {
-                    List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
-                    if (list.size() > 0) {
-                        PointData po = list.get(0);
-                        po.setPointValueInDouble(StringUtils.round(po.getPointValueInDouble(), 4));
-                        return po;
-                    } else {
-                        return ErrorRequest.RequestError(pointid);
-                    }
-                } else {
-                    return ErrorRequest.RequestError(pointid);
-                }
 
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    //System.out.println("404请求错误");
-                    return ErrorRequest.RequestError(pointid);
-                } else {
-                    return ErrorRequest.RequestError(pointid);
-                }
-            }
-        } else {
-            PointData po = new PointData();
-            po.setEdnaId(pointid);
-            po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
-            return po;
-        }
 
+    @Override
+    public PointData getRealData(String pointid) throws Exception {
+        List<String> pointids = new ArrayList<>();
+        pointids.add(pointid);
+        List<PointData> realData = getRealData(pointids);
+        return realData.get(0);
     }
 
+
     @Override
 //    public List<PointData> getRealData(String... pointids) throws Exception {
     public List<PointData> getRealData(List<String> pointids) throws Exception {