|
@@ -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 {
|