|
@@ -1,18 +1,17 @@
|
|
|
package com.gyee.datacenter.util.realtimesource;
|
|
|
|
|
|
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-
|
|
|
import com.gyee.common.model.DNAStatVal;
|
|
|
import com.gyee.common.model.DNAVal;
|
|
|
import com.gyee.common.model.PointData;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
-import com.gyee.datacenter.model.auto.Windpowerstationtestingpoint;
|
|
|
-import com.gyee.datacenter.model.auto.Windturbinetestingpointai;
|
|
|
+import com.gyee.datacenter.model.auto.Windpowerstationpointnew;
|
|
|
+import com.gyee.datacenter.model.auto.Windturbinetestingpointnew;
|
|
|
import com.gyee.datacenter.util.realtimesource.timeseries.ErrorRequest;
|
|
|
import com.gyee.datacenter.util.realtimesource.timeseries.JsonObjectHelper;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -27,10 +26,10 @@ import java.util.*;
|
|
|
public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
private RestTemplate restTemplate =new RestTemplate();
|
|
|
- private static String baseURL = "http://10.83.68.205:8011/ts";
|
|
|
-// private static String baseURL = "http://10.65.79.30:8019/ts";
|
|
|
+ @Value("${golden.baseURL}")
|
|
|
+ private String baseURL;
|
|
|
@Override
|
|
|
- public PointData getRealData(Windpowerstationtestingpoint point) throws Exception {
|
|
|
+ public PointData getRealData(Windpowerstationpointnew point) throws Exception {
|
|
|
try {
|
|
|
Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingType = Optional.ofNullable("station");
|
|
@@ -49,7 +48,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -70,7 +69,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasSnap(Windpowerstationtestingpoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
+ public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
@@ -116,53 +115,53 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if(snapList.isEmpty())
|
|
|
{
|
|
|
|
|
|
- getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
|
|
|
+ getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
- for (PointData snapItem : snapList) {
|
|
|
-
|
|
|
- long subTime = snapItem.getPointTime() - pried;
|
|
|
- //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
- // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
- // 则代表该时间节点快照有效,否则为0
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
- ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
- JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
-
|
|
|
- if (jsonObjectSection != null) {
|
|
|
- List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
- if (sectionlist.size() > 0) {
|
|
|
- if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
- resultList.add(snapItem);
|
|
|
- }
|
|
|
- else{
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
+ for (PointData snapItem : snapList) {
|
|
|
+
|
|
|
+ long subTime = snapItem.getPointTime() - pried;
|
|
|
+ //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
+ // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
+ // 则代表该时间节点快照有效,否则为0
|
|
|
+ String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
+ ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
+ JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
+
|
|
|
+ if (jsonObjectSection != null) {
|
|
|
+ List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
+ if (sectionlist.size() > 0) {
|
|
|
+ if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
+ resultList.add(snapItem);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(point.getCode());
|
|
|
+ data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(point.getCode());
|
|
|
+ data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(point.getCode());
|
|
|
+ data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -185,52 +184,52 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void getHistsnapSameTiem(String pointid, Long beginDate, Long pried,
|
|
|
- List<PointData> resultList) {
|
|
|
- long subTime =beginDate - pried;
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate + "000";
|
|
|
- ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
- JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
- if (jsonObjectSection != null) {
|
|
|
- List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
- if (sectionlist.size() > 0) {
|
|
|
- if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=beginDate){
|
|
|
- resultList.add(sectionlist.get(0));
|
|
|
- }
|
|
|
- else{
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- if (sectionlist!=null && sectionlist.size()>0){
|
|
|
- data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
- }
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- data.setPointTime(beginDate);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
+ private void getHistsnapSameTiem(String pointid, Long beginDate, Long pried,
|
|
|
+ List<PointData> resultList) {
|
|
|
+ long subTime =beginDate - pried;
|
|
|
+ String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate + "000";
|
|
|
+ ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
+ JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
+ if (jsonObjectSection != null) {
|
|
|
+ List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
+ if (sectionlist.size() > 0) {
|
|
|
+ if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=beginDate){
|
|
|
+ resultList.add(sectionlist.get(0));
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(pointid);
|
|
|
+ data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(pointid);
|
|
|
+ if (sectionlist!=null && sectionlist.size()>0){
|
|
|
+ data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
+ }
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PointData data = new PointData();
|
|
|
+ data.setEdnaId(pointid);
|
|
|
+ data.setPointTime(beginDate);
|
|
|
+ data.setPointValue("0");
|
|
|
+ data.setPointName("1");
|
|
|
+ data.setPointValueInDouble(0.0);
|
|
|
+ resultList.add(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasRaw(Windpowerstationtestingpoint point, Long beginDate, Long endDate) throws Exception {
|
|
|
+ public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
@@ -276,8 +275,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PointData getRealData(Windturbinetestingpointai point) throws Exception {
|
|
|
- Optional<String> keys = Optional.ofNullable(point.getId());
|
|
|
+ public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
|
|
|
+ Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> uniformCodes = Optional.ofNullable(point.getUniformcode());
|
|
@@ -297,7 +296,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -318,14 +317,14 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasSnap(Windturbinetestingpointai point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
+ public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
if (point==null){
|
|
|
System.out.println(1111);
|
|
|
|
|
|
}else if(point.getId()==null){
|
|
|
System.out.println(222);
|
|
|
}
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getId());
|
|
|
+ Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
|
Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
|
|
@@ -370,10 +369,10 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if(snapList.isEmpty())
|
|
|
{
|
|
|
|
|
|
- getHistsnapSameTiem(point.getId(), beginDate, pried, resultList);
|
|
|
+ getHistsnapSameTiem(point.getId(), beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
- for (PointData snapItem : snapList) {
|
|
|
+ for (PointData snapItem : snapList) {
|
|
|
long subTime = snapItem.getPointTime() - pried;
|
|
|
//查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
// 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
@@ -385,7 +384,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if (jsonObjectSection != null) {
|
|
|
List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
if (sectionlist.size() > 0) {
|
|
|
- resultList.add(snapItem);
|
|
|
+ resultList.add(snapItem);
|
|
|
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
@@ -425,8 +424,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasRaw(Windturbinetestingpointai point, Long beginDate, Long endDate) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getId());
|
|
|
+ public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
+ Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
|
Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
|
|
@@ -480,7 +479,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -555,7 +554,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
pointData.setPointValue(pointValue);
|
|
|
pointData.setPointValueInDouble(Double.parseDouble(pointValue));
|
|
|
- // System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
|
|
|
+ // System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
|
|
|
}
|
|
|
return result;
|
|
|
|
|
@@ -640,7 +639,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
pointData.setPointValue(pointValue);
|
|
|
|
|
|
pointData.setPointValueInDouble(Double.parseDouble(pointValue));
|
|
|
- // System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
|
|
|
+ // System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
|
|
|
}
|
|
|
return result;
|
|
|
|
|
@@ -672,7 +671,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
return null;
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
Iterator<String> sIterator = jsonArray.keySet().iterator();
|
|
|
Map<String, Double> resultMap = new HashMap();
|
|
|
while (sIterator.hasNext()) {
|
|
@@ -708,41 +707,41 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
- Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
|
- Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
-
|
|
|
- //通过时间区间和时间间隔获取点数
|
|
|
- Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
- finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
- finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
- return ErrorRequest.RequestListError(pointid);
|
|
|
- Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
-
|
|
|
- try {
|
|
|
- String url = baseURL + "/history/snap?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();
|
|
|
-
|
|
|
- ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
- JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null) {
|
|
|
- List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray,tagName.get());
|
|
|
- List<PointData> resultList = new ArrayList<>();
|
|
|
- return list;
|
|
|
+ @Override
|
|
|
+ public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
+ Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
+ Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
|
+ Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
+
|
|
|
+ //通过时间区间和时间间隔获取点数
|
|
|
+ Long finalInterval;
|
|
|
+ if (pried != null)
|
|
|
+ finalInterval = pried;
|
|
|
+ else if (count != null)
|
|
|
+ finalInterval = (endDate - beginDate) / count;
|
|
|
+ else
|
|
|
+ return ErrorRequest.RequestListError(pointid);
|
|
|
+ Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
+
|
|
|
+ try {
|
|
|
+ String url = baseURL + "/history/snap?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();
|
|
|
+
|
|
|
+ ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
+ JSONArray jsonArray = resp.getBody();
|
|
|
+ if (jsonArray != null) {
|
|
|
+ List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray,tagName.get());
|
|
|
+ List<PointData> resultList = new ArrayList<>();
|
|
|
+ return list;
|
|
|
//
|
|
|
// if(list.isEmpty())
|
|
|
// {
|
|
@@ -796,20 +795,20 @@ public class EdosUtil implements IEdosUtil {
|
|
|
// }
|
|
|
//
|
|
|
// return resultList;
|
|
|
- } else {
|
|
|
- return ErrorRequest.RequestListError(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;
|
|
|
- }
|
|
|
- }
|
|
|
+ } catch (HttpClientErrorException exception) {
|
|
|
+ if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
+ System.out.println("404请求错误");
|
|
|
+ return ErrorRequest.RequestListError(pointid);
|
|
|
+ } else {
|
|
|
+ throw exception;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -847,8 +846,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistStat(Windturbinetestingpointai point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getId());
|
|
|
+ public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
+ Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
|
Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
|
|
@@ -909,7 +908,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistStat(Windpowerstationtestingpoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
+ public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
@@ -1116,14 +1115,14 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty()){
|
|
|
return JsonObjectHelper.phraseDNAVal(jsonObject,tagNames);
|
|
|
} else {
|
|
|
- DNAVal[] errorResult = new DNAVal[tagNames.length];
|
|
|
- for(int i=0;i<tagNames.length;i++)
|
|
|
- {
|
|
|
- DNAVal val = new DNAVal();
|
|
|
- val.Status = 0;
|
|
|
- errorResult[i] = val;
|
|
|
- }
|
|
|
- return errorResult;
|
|
|
+ DNAVal[] errorResult = new DNAVal[tagNames.length];
|
|
|
+ for(int i=0;i<tagNames.length;i++)
|
|
|
+ {
|
|
|
+ DNAVal val = new DNAVal();
|
|
|
+ val.Status = 0;
|
|
|
+ errorResult[i] = val;
|
|
|
+ }
|
|
|
+ return errorResult;
|
|
|
}
|
|
|
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1132,9 +1131,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
DNAVal[] errorResult = new DNAVal[tagNames.length];
|
|
|
for(int i=0;i<tagNames.length;i++)
|
|
|
{
|
|
|
- DNAVal val = new DNAVal();
|
|
|
- val.Status = 0;
|
|
|
- errorResult[i] = val;
|
|
|
+ DNAVal val = new DNAVal();
|
|
|
+ val.Status = 0;
|
|
|
+ errorResult[i] = val;
|
|
|
}
|
|
|
return errorResult;
|
|
|
} else {
|
|
@@ -1239,29 +1238,31 @@ public class EdosUtil implements IEdosUtil {
|
|
|
JSONObject jsonObject = resp.getBody();
|
|
|
if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty())
|
|
|
{
|
|
|
- return JsonObjectHelper.phraseDNAVal(jsonObject,nameList);
|
|
|
+ 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;
|
|
|
+ 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;
|
|
|
+ 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;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|