|
@@ -211,7 +211,6 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getHistoryDatasSnap(ProBasicPowerstationPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
public List<PointData> getHistoryDatasSnap(ProBasicPowerstationPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
@@ -396,7 +395,6 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getHistoryDatasRaw(ProBasicPowerstationPoint point, Long beginDate, Long endDate) throws Exception {
|
|
public List<PointData> getHistoryDatasRaw(ProBasicPowerstationPoint point, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
@@ -656,67 +654,6 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<PointData> getHistoryDatasRaw(ProBasicEquipmentPoint point, Long beginDate, Long endDate) throws Exception {
|
|
|
|
- if (StringUtils.notEmp(point) && StringUtils.notEmp(point.getNemCode()) && !initialcode.equals(point.getNemCode())) {
|
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getNemCode());
|
|
|
|
- Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationId());
|
|
|
|
- Optional<String> thingType = Optional.ofNullable(point.getModelId());
|
|
|
|
- Optional<String> uniformCode = Optional.ofNullable(point.getUniformCode());
|
|
|
|
- Optional<Long> startTs = Optional.ofNullable(beginDate);
|
|
|
|
- Optional<Long> endTs = Optional.ofNullable(endDate);
|
|
|
|
- try {
|
|
|
|
- String url = "";
|
|
|
|
- if (point.getNemCode().startsWith("GF-")) {
|
|
|
|
- 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();
|
|
|
|
- else {
|
|
|
|
- if (thingType.isPresent())
|
|
|
|
- url = url + "&thingType=" + thingType.get();
|
|
|
|
- if (thingId.isPresent())
|
|
|
|
- url = url + "&thingId=" + thingId.get();
|
|
|
|
- if (uniformCode.isPresent())
|
|
|
|
- url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (startTs.isPresent())
|
|
|
|
- url = url + "&startTs=" + startTs.get();
|
|
|
|
- if (endTs.isPresent())
|
|
|
|
- url = url + "&endTs=" + endTs.get();
|
|
|
|
-
|
|
|
|
- ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
|
- JSONArray jsonArray = resp.getBody();
|
|
|
|
- if (jsonArray != null)
|
|
|
|
- return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
|
|
- else {
|
|
|
|
- return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
- }
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- //System.out.println("404请求错误");
|
|
|
|
- return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- List<PointData> pols = new ArrayList<>();
|
|
|
|
- PointData po = new PointData();
|
|
|
|
- po.setEdnaId(point.getNemCode());
|
|
|
|
- po.setPointValueInDouble(0.0);
|
|
|
|
- po.setPointTime(0l);
|
|
|
|
- pols.add(po);
|
|
|
|
- return pols;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public PointData getRealData(String pointid) throws Exception {
|
|
public PointData getRealData(String pointid) throws Exception {
|
|
|
|
|
|
@@ -857,7 +794,6 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getRealData(List<String> pointids) throws Exception {
|
|
public List<PointData> getRealData(List<String> pointids) throws Exception {
|
|
|
|
|
|
@@ -949,88 +885,6 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Map<String, Double> getRealDataMap(String... pointids) throws Exception {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (StringUtils.notEmp(pointids)) {
|
|
|
|
- List<String> idls = new ArrayList<>();
|
|
|
|
- for (String str : pointids) {
|
|
|
|
- if (StringUtils.notEmp(str) && !initialcode.equals(str)) {
|
|
|
|
- idls.add(str);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!idls.isEmpty()) {
|
|
|
|
- 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();
|
|
|
|
- else
|
|
|
|
- return null;
|
|
|
|
- ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
|
- JSONObject jsonArray = resp.getBody();
|
|
|
|
- if (StringUtils.isNotEmpty(jsonArray)) {
|
|
|
|
- Iterator<String> sIterator = jsonArray.keySet().iterator();
|
|
|
|
- Map<String, Double> resultMap = new HashMap();
|
|
|
|
- while (sIterator.hasNext()) {
|
|
|
|
- // 获得key
|
|
|
|
- String key = sIterator.next();
|
|
|
|
- // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
|
|
|
|
- JSONObject jsonData = jsonArray.getJSONObject(key);
|
|
|
|
- Long ts = jsonData.getLong("ts");
|
|
|
|
- String pointValue = null;
|
|
|
|
- if (jsonData.containsKey("doubleValue")) {
|
|
|
|
- pointValue = jsonData.getString("doubleValue");
|
|
|
|
- } else if (jsonData.containsKey("booleanValue")) {
|
|
|
|
- pointValue = jsonData.getString("booleanValue");
|
|
|
|
- } else if (jsonData.containsKey("longValue")) {
|
|
|
|
- pointValue = jsonData.getString("longValue");
|
|
|
|
- } else if (jsonData.containsKey("stringValue")) {
|
|
|
|
- pointValue = jsonData.getString("stringValue");
|
|
|
|
- }
|
|
|
|
- resultMap.put(key, Double.parseDouble(pointValue));
|
|
|
|
- }
|
|
|
|
- return resultMap;
|
|
|
|
-
|
|
|
|
- } else
|
|
|
|
- return ErrorRequest.RequestMapError();
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- //System.out.println("404请求错误");
|
|
|
|
- return ErrorRequest.RequestMapError();
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Map<String, Double> map = new HashMap<>();
|
|
|
|
- for (String str : pointids) {
|
|
|
|
-
|
|
|
|
- map.put(str, 0.0);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return map;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- Map<String, Double> map = new HashMap<>();
|
|
|
|
-
|
|
|
|
- for (String str : pointids) {
|
|
|
|
-
|
|
|
|
- map.put(str, 0.0);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return map;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
|
|
if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
|
|
@@ -1158,58 +1012,6 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
|
|
|
|
- Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
|
- Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
|
|
- 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();
|
|
|
|
- if (startTs.isPresent())
|
|
|
|
- url = url + "&startTs=" + startTs.get();
|
|
|
|
- if (endTs.isPresent())
|
|
|
|
- url = url + "&endTs=" + endTs.get();
|
|
|
|
-
|
|
|
|
- ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
|
-
|
|
|
|
- JSONArray jsonArray = resp.getBody();
|
|
|
|
- if (jsonArray != null)
|
|
|
|
- return JsonObjectHelper.phrasePointData(jsonArray, pointid);
|
|
|
|
- else {
|
|
|
|
- return ErrorRequest.RequestListError(pointid);
|
|
|
|
- }
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- //System.out.println("404请求错误");
|
|
|
|
- return ErrorRequest.RequestListError(pointid);
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- List<PointData> pols = new ArrayList<>();
|
|
|
|
- PointData po = new PointData();
|
|
|
|
- po.setEdnaId(pointid);
|
|
|
|
- po.setPointValueInDouble(0.0);
|
|
|
|
- po.setPointTime(0l);
|
|
|
|
- pols.add(po);
|
|
|
|
- return pols;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getHistStat(ProBasicEquipmentPoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
public List<PointData> getHistStat(ProBasicEquipmentPoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
@@ -1421,90 +1223,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
|
|
public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
|
|
-
|
|
|
|
-
|
|
|
|
- if (StringUtils.notEmp(point) && !initialcode.equals(point)) {
|
|
|
|
- Optional<String> tagName = Optional.ofNullable(point);
|
|
|
|
- Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
|
|
- Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
- //通过时间区间和时间间隔获取点数
|
|
|
|
- Optional<Integer> interval = Optional.ofNullable(pried);
|
|
|
|
-
|
|
|
|
- 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();
|
|
|
|
- if (startTs.isPresent())
|
|
|
|
- url = url + "&startTs=" + startTs.get();
|
|
|
|
- if (endTs.isPresent())
|
|
|
|
- url = url + "&endTs=" + endTs.get();
|
|
|
|
- if (interval.isPresent())
|
|
|
|
- url = url + "&interval=" + interval.get();
|
|
|
|
-
|
|
|
|
- ////System.out.println(restTemplate.getForEntity(url, JSONArray.class));
|
|
|
|
- ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
|
- if (resp != null) {
|
|
|
|
- JSONArray jsonArray = resp.getBody();
|
|
|
|
- if (jsonArray == null || jsonArray.size() <= 0) {
|
|
|
|
- DNAStatVal[] dnaVal = new DNAStatVal[1];
|
|
|
|
- DNAVal errorData = new DNAVal();
|
|
|
|
- errorData.Status = 0;
|
|
|
|
-
|
|
|
|
- DNAStatVal val = new DNAStatVal();
|
|
|
|
- val.avg = errorData;
|
|
|
|
- val.max = errorData;
|
|
|
|
- val.min = errorData;
|
|
|
|
- dnaVal[0] = val;
|
|
|
|
- return dnaVal;
|
|
|
|
- } else {
|
|
|
|
- return JsonObjectHelper.phraseDNAVal(jsonArray);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- //System.out.println("404请求错误");
|
|
|
|
- DNAStatVal val = new DNAStatVal();
|
|
|
|
- DNAStatVal[] dnaVal = new DNAStatVal[1];
|
|
|
|
- DNAVal errorData = new DNAVal();
|
|
|
|
- errorData.Status = 0;
|
|
|
|
- val.avg = errorData;
|
|
|
|
- val.max = errorData;
|
|
|
|
- val.min = errorData;
|
|
|
|
- dnaVal[0] = val;
|
|
|
|
- return dnaVal;
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- DNAStatVal val = new DNAStatVal();
|
|
|
|
- DNAStatVal[] dnaVal = new DNAStatVal[1];
|
|
|
|
- DNAVal errorData = new DNAVal();
|
|
|
|
- errorData.Status = 0;
|
|
|
|
- val.avg = errorData;
|
|
|
|
- val.max = errorData;
|
|
|
|
- val.min = errorData;
|
|
|
|
- dnaVal[0] = val;
|
|
|
|
- return dnaVal;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- DNAStatVal val = new DNAStatVal();
|
|
|
|
- DNAStatVal[] dnaVal = new DNAStatVal[1];
|
|
|
|
- DNAVal errorData = new DNAVal();
|
|
|
|
- errorData.Status = 0;
|
|
|
|
- val.avg = errorData;
|
|
|
|
- val.max = errorData;
|
|
|
|
- val.min = errorData;
|
|
|
|
- dnaVal[0] = val;
|
|
|
|
- return dnaVal;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ return new DNAStatVal[0];
|
|
}
|
|
}
|
|
|
|
|
|
private JSONObject convertPointData(PointData pd) {
|
|
private JSONObject convertPointData(PointData pd) {
|
|
@@ -1519,65 +1238,6 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@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) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- return;
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- DNAVal[] result = new DNAVal[tagNames.length];
|
|
|
|
- for (int i = 0; i < tagNames.length; i++) {
|
|
|
|
- if (StringUtils.notEmp(tagNames[i]) && !initialcode.equals(tagNames[i])) {
|
|
|
|
- PointData po = getRealData(tagNames[i]);
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.DValue = po.getPointValueInDouble();
|
|
|
|
- if (StringUtils.notEmp(po.getPointTime())) {
|
|
|
|
- val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
|
|
|
|
- } else {
|
|
|
|
- val.Time = 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- val.Status = 1;
|
|
|
|
- result[i] = val;
|
|
|
|
- } else {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- result[i] = val;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
- } else {
|
|
|
|
- DNAVal[] result = new DNAVal[tagNames.length];
|
|
|
|
- for (int i = 0; i < tagNames.length; i++) {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- result[i] = val;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
public void updatePoint(List<PointData> pointls) throws Exception {
|
|
public void updatePoint(List<PointData> pointls) throws Exception {
|
|
String url = baseURL + "/history/batch";
|
|
String url = baseURL + "/history/batch";
|
|
if (!pointls.isEmpty()) {
|
|
if (!pointls.isEmpty()) {
|
|
@@ -1680,128 +1340,14 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
|
|
public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
|
|
- String url = baseURL + "/latest/batch";
|
|
|
|
|
|
|
|
- List<JSONObject> writeDataList = new ArrayList<>();
|
|
|
|
- if (realvalue != null && pointls != null & realvalue.length == pointls.length) {
|
|
|
|
- for (int i = 0; i < realvalue.length; i++) {
|
|
|
|
- PointData writeData = new PointData();
|
|
|
|
- writeData.setEdnaId(realvalue[i]);
|
|
|
|
- writeData.setPointValueInDouble(pointls[i].DValue);
|
|
|
|
- writeData.setPointTime((long) pointls[i].Time);
|
|
|
|
- JSONObject jsonObject = convertPointData(writeData);
|
|
|
|
- writeDataList.add(jsonObject);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- String result = restTemplate.postForObject(url, writeDataList, String.class);
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- System.out.println("404请求错误");
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else
|
|
|
|
- return;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception {
|
|
public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception {
|
|
- if (StringUtils.notEmp(nameList)) {
|
|
|
|
- List<String> idls = new ArrayList<>();
|
|
|
|
- for (String str : nameList) {
|
|
|
|
- if (StringUtils.notEmp(str) && !initialcode.equals(str)) {
|
|
|
|
- idls.add(str);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!idls.isEmpty() && idls.size() == nameList.length) {
|
|
|
|
- String tagNameString = StringUtil.join(nameList, ",");
|
|
|
|
- Long time = Long.valueOf(tTime);
|
|
|
|
- Optional<String> tagName = Optional.ofNullable(tagNameString);
|
|
|
|
- Optional<Long> ts = Optional.ofNullable(time * 1000);
|
|
|
|
- String url = baseURL + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
|
|
|
|
- try {
|
|
|
|
- ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
|
- JSONObject jsonObject = resp.getBody();
|
|
|
|
- if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty()) {
|
|
|
|
- return JsonObjectHelper.phraseDNAVal(jsonObject, nameList);
|
|
|
|
- } else {
|
|
|
|
- DNAVal[] errorResult = new DNAVal[nameList.length];
|
|
|
|
- for (int i = 0; i < nameList.length; i++) {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- errorResult[i] = val;
|
|
|
|
- }
|
|
|
|
- return errorResult;
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- DNAVal[] errorResult = new DNAVal[nameList.length];
|
|
|
|
- for (int i = 0; i < nameList.length; i++) {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- errorResult[i] = val;
|
|
|
|
- }
|
|
|
|
- return errorResult;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- DNAVal[] errorResult = new DNAVal[nameList.length];
|
|
|
|
- for (int i = 0; i < nameList.length; i++) {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- errorResult[i] = val;
|
|
|
|
- }
|
|
|
|
- return errorResult;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- DNAVal[] errorResult = new DNAVal[nameList.length];
|
|
|
|
- for (int i = 0; i < nameList.length; i++) {
|
|
|
|
- DNAVal val = new DNAVal();
|
|
|
|
- val.Status = 0;
|
|
|
|
- errorResult[i] = val;
|
|
|
|
- }
|
|
|
|
- return errorResult;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void sendMultiRealTimeParamete(List<RealTimeParameterVo> pointls) throws Exception {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String url = baseURL + "/latest/batch";
|
|
|
|
- List<JSONObject> writeList = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for (RealTimeParameterVo entity : pointls) {
|
|
|
|
- writeList.add(convertRealTimeParamete(entity));
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- String result = restTemplate.postForObject(url, writeList, String.class);
|
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
- System.out.println("404请求错误");
|
|
|
|
- } else {
|
|
|
|
- throw exception;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ return new DNAVal[0];
|
|
}
|
|
}
|
|
|
|
|
|
- private JSONObject convertRealTimeParamete(RealTimeParameterVo pd) {
|
|
|
|
- JSONObject jo = new JSONObject();
|
|
|
|
- jo.put("tagName", pd.getPoint());
|
|
|
|
- JSONObject joo = new JSONObject();
|
|
|
|
- joo.put("ts", pd.getTime().getTime());
|
|
|
|
- joo.put("status", 0);
|
|
|
|
- joo.put("doubleValue", pd.getInsertValue());
|
|
|
|
- jo.put("tsData", joo);
|
|
|
|
- return jo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
@@ -1910,10 +1456,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//多点切面数据
|
|
//多点切面数据
|
|
-
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public List<PointData> getHistMatrix(List<String> nameList, long tTime) throws Exception {
|
|
public List<PointData> getHistMatrix(List<String> nameList, long tTime) throws Exception {
|
|
String tagNameString = StringUtil.join(nameList, ",");
|
|
String tagNameString = StringUtil.join(nameList, ",");
|
|
@@ -1983,5 +1526,4 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|