|
@@ -3,7 +3,7 @@ package com.gyee.backconfig.until.realtimedate;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.backconfig.model.auto.ProBasicEquipmentPoint;
|
|
|
-import com.gyee.backconfig.model.auto.ProBasicWppoint;
|
|
|
+import com.gyee.backconfig.model.auto.ProBasicPowerstationPoint;
|
|
|
import com.gyee.common.model.DNAStatVal;
|
|
|
import com.gyee.common.model.DNAVal;
|
|
|
import com.gyee.common.model.PointData;
|
|
@@ -22,9 +22,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
private RestTemplate restTemplate =new RestTemplate();
|
|
|
private static String baseURL = "http://10.81.3.155:8011/ts";
|
|
|
@Override
|
|
|
- public PointData getRealData(ProBasicWppoint point) throws Exception {
|
|
|
+ public PointData getRealData(ProBasicPowerstationPoint point) throws Exception {
|
|
|
try {
|
|
|
- Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
|
+ Optional<String> keys = Optional.ofNullable(point.getNemCode());
|
|
|
Optional<String> thingType = Optional.ofNullable("station");
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationId());
|
|
|
Optional<String> uniformCodes = Optional.ofNullable(point.getUniformCode());
|
|
@@ -46,14 +46,14 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
|
else
|
|
|
- return ErrorRequest.RequestError(point.getCode());
|
|
|
+ return ErrorRequest.RequestError(point.getNemCode());
|
|
|
} else {
|
|
|
- return ErrorRequest.RequestError(point.getCode());
|
|
|
+ return ErrorRequest.RequestError(point.getNemCode());
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
System.out.println("404请求错误");
|
|
|
- return ErrorRequest.RequestError(point.getCode());
|
|
|
+ return ErrorRequest.RequestError(point.getNemCode());
|
|
|
} else {
|
|
|
throw exception;
|
|
|
}
|
|
@@ -62,8 +62,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasSnap(ProBasicWppoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
+ public List<PointData> getHistoryDatasSnap(ProBasicPowerstationPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
+ 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());
|
|
@@ -76,7 +76,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
else if (count != null)
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
else
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -102,13 +102,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
if (jsonArray != null) {
|
|
|
- List<PointData> snapList = JsonObjectHelper.phrasePointData(jsonArray, point.getCode());
|
|
|
+ List<PointData> snapList = JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
|
List<PointData> resultList = new ArrayList<>();
|
|
|
|
|
|
if(snapList.isEmpty())
|
|
|
{
|
|
|
|
|
|
- getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
|
|
|
+ getHistsnapSameTiem(point.getNemCode(), beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
for (PointData snapItem : snapList) {
|
|
@@ -117,7 +117,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
//查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
// 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
// 则代表该时间节点快照有效,否则为0
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
+ String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getNemCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
|
|
@@ -129,7 +129,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
else{
|
|
|
PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
+ data.setEdnaId(point.getNemCode());
|
|
|
data.setPointTime(snapItem.getPointTime());
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
@@ -138,7 +138,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
+ data.setEdnaId(point.getNemCode());
|
|
|
data.setPointTime(snapItem.getPointTime());
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
@@ -147,7 +147,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
+ data.setEdnaId(point.getNemCode());
|
|
|
data.setPointTime(snapItem.getPointTime());
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
@@ -162,13 +162,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
} else {
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
|
|
|
} catch (HttpClientErrorException exception) {
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
System.out.println("404请求错误");
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
} else {
|
|
|
throw exception;
|
|
|
}
|
|
@@ -222,8 +222,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistoryDatasRaw(ProBasicWppoint point, Long beginDate, Long endDate) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
+ public List<PointData> getHistoryDatasRaw(ProBasicPowerstationPoint point, Long beginDate, Long endDate) throws Exception {
|
|
|
+ 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());
|
|
@@ -252,15 +252,15 @@ public class EdosUtil implements IEdosUtil {
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
if (jsonArray != null)
|
|
|
- return JsonObjectHelper.phrasePointData(jsonArray, point.getCode());
|
|
|
+ return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
|
else {
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
|
|
|
} catch (HttpClientErrorException exception) {
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
System.out.println("404请求错误");
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
} else {
|
|
|
throw exception;
|
|
|
}
|
|
@@ -901,8 +901,8 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PointData> getHistStat(ProBasicWppoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
- Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
+ public List<PointData> getHistStat(ProBasicPowerstationPoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
+ 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());
|
|
@@ -915,7 +915,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
else if (count != null)
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
else
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -941,14 +941,14 @@ public class EdosUtil implements IEdosUtil {
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
if (jsonArray != null)
|
|
|
- return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getCode(), type);
|
|
|
+ return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
|
else {
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
System.out.println("404请求错误");
|
|
|
- return ErrorRequest.RequestListError(point.getCode());
|
|
|
+ return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
} else {
|
|
|
throw exception;
|
|
|
}
|