|
@@ -51,23 +51,28 @@ public class EdosUtil implements IEdosUtil {
|
|
|
if (point.getNemCode().startsWith("GF-")){
|
|
|
url = baseURL2 + "/latest?null=0";
|
|
|
}
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- if (thingType.isPresent())
|
|
|
+ }
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCodes.isPresent())
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
}
|
|
@@ -84,7 +89,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
|
|
@@ -105,10 +110,11 @@ public class EdosUtil implements IEdosUtil {
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
- if (list.size() > 0)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(point);
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(point);
|
|
|
}
|
|
@@ -117,7 +123,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point);
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
}
|
|
@@ -135,10 +141,11 @@ public class EdosUtil implements IEdosUtil {
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
- if (list.size() > 0)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
}
|
|
@@ -147,7 +154,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
|
|
@@ -170,10 +177,11 @@ public class EdosUtil implements IEdosUtil {
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
- if (list.size() > 0)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
}
|
|
@@ -182,7 +190,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
}
|
|
@@ -201,12 +209,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
+ if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
+ } else if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -216,22 +225,28 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -276,7 +291,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getNemCode());
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -285,7 +300,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getNemCode());
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -316,7 +331,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -355,7 +370,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -391,27 +406,32 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
|
|
@@ -429,7 +449,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -455,24 +475,28 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCodes.isPresent())
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
}
|
|
@@ -490,7 +514,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
|
|
@@ -509,12 +533,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
+ if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
+ } else if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -525,22 +550,28 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL + "/history/snap?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -586,7 +617,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getNemCode());
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -595,7 +626,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getNemCode());
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -623,7 +654,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -649,27 +680,32 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL + "/history/snap?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -686,7 +722,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -705,19 +741,21 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- else
|
|
|
+ } 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)
|
|
|
+ if (list.size() > 0) {
|
|
|
return list.get(0);
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestError(pointid);
|
|
|
+ }
|
|
|
} else {
|
|
|
return ErrorRequest.RequestError(pointid);
|
|
|
}
|
|
@@ -735,7 +773,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(pointid);
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
return po;
|
|
|
}
|
|
|
|
|
@@ -752,9 +790,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/latest?null=0";
|
|
|
}
|
|
|
try {
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(pointids);
|
|
|
}
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
@@ -784,8 +822,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
// 获得key
|
|
|
String key = sIterator.next();
|
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
|
- if (pointData == null)
|
|
|
+ if (pointData == null) {
|
|
|
continue;
|
|
|
+ }
|
|
|
// 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
|
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
|
Long ts = jsonData.getLong("ts");
|
|
@@ -846,9 +885,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/latest?null=0";
|
|
|
}
|
|
|
try {
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- else {
|
|
|
+ } else {
|
|
|
String[] arr = new String[pointids.size()];
|
|
|
return ErrorRequest.RequestListError(pointids.toArray(arr));
|
|
|
}
|
|
@@ -880,8 +919,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
// 获得key
|
|
|
String key = sIterator.next();
|
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
|
- if (pointData == null)
|
|
|
+ if (pointData == null) {
|
|
|
continue;
|
|
|
+ }
|
|
|
// 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
|
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
|
Long ts = jsonData.getLong("ts");
|
|
@@ -951,10 +991,11 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/latest?null=0";
|
|
|
}
|
|
|
try {
|
|
|
- if (keys.isPresent())
|
|
|
+ if (keys.isPresent()) {
|
|
|
url = url + "&keys=" + keys.get();
|
|
|
- else
|
|
|
+ } else {
|
|
|
return null;
|
|
|
+ }
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
@@ -980,8 +1021,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
}
|
|
|
return resultMap;
|
|
|
|
|
|
- } else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestMapError();
|
|
|
+ }
|
|
|
} catch (HttpClientErrorException exception) {
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
//System.out.println("404请求错误");
|
|
@@ -1029,12 +1071,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
+ if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
+ } else if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(pointid);
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -1043,15 +1086,19 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
+ }
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -1095,7 +1142,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1104,7 +1151,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0l);
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1132,7 +1179,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(pointid);
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -1158,19 +1205,22 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/raw?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- if (startTs.isPresent())
|
|
|
+ }
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.phrasePointData(jsonArray, pointid);
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(pointid);
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1187,7 +1237,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(pointid);
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -1214,12 +1264,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
+ if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
+ } else if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -1230,28 +1281,34 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL + "/history/stat?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1268,7 +1325,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -1288,12 +1345,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (pried != null)
|
|
|
+ if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else if (count != null)
|
|
|
+ } else if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
@@ -1302,28 +1360,34 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- else {
|
|
|
- if (thingType.isPresent())
|
|
|
+ } else {
|
|
|
+ if (thingType.isPresent()) {
|
|
|
url = url + "&thingType=" + thingType.get();
|
|
|
- if (thingId.isPresent())
|
|
|
+ }
|
|
|
+ if (thingId.isPresent()) {
|
|
|
url = url + "&thingId=" + thingId.get();
|
|
|
- if (uniformCode.isPresent())
|
|
|
+ }
|
|
|
+ if (uniformCode.isPresent()) {
|
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
+ }
|
|
|
}
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1340,7 +1404,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(point.getNemCode());
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -1358,12 +1422,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
Long finalInterval;
|
|
|
- if (count != null)
|
|
|
+ if (count != null) {
|
|
|
finalInterval = (endDate - beginDate) / count;
|
|
|
- else if (pried != null)
|
|
|
+ } else if (pried != null) {
|
|
|
finalInterval = pried;
|
|
|
- else
|
|
|
+ } else {
|
|
|
return null;
|
|
|
+ }
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
try {
|
|
|
String url = baseURL + "/history/stat?null=0";
|
|
@@ -1371,20 +1436,24 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- if (startTs.isPresent())
|
|
|
+ }
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
|
- if (jsonArray != null)
|
|
|
+ if (jsonArray != null) {
|
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, pointid, type);
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return ErrorRequest.RequestListError(pointid);
|
|
|
}
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1402,7 +1471,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
PointData po=new PointData();
|
|
|
po.setEdnaId(pointid);
|
|
|
po.setPointValueInDouble(0.0);
|
|
|
- po.setPointTime(0l);
|
|
|
+ po.setPointTime(0L);
|
|
|
pols.add(po);
|
|
|
return pols;
|
|
|
}
|
|
@@ -1427,14 +1496,18 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
- if (startTs.isPresent())
|
|
|
+ }
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=" + interval.get();
|
|
|
+ }
|
|
|
|
|
|
////System.out.println(restTemplate.getForEntity(url, JSONArray.class));
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
@@ -1650,8 +1723,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
throw exception;
|
|
|
}
|
|
|
}
|
|
|
- } else
|
|
|
+ } else {
|
|
|
return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1772,7 +1846,7 @@ public class EdosUtil implements IEdosUtil {
|
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
//通过时间区间和时间间隔获取点数
|
|
|
- Long finalInterval=60l;
|
|
|
+ Long finalInterval= 60L;
|
|
|
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
@@ -1782,15 +1856,19 @@ public class EdosUtil implements IEdosUtil {
|
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
|
}
|
|
|
//tagName 或thingType,thingId,uniformCode可以确定一个标签点
|
|
|
- if (tagName.isPresent())
|
|
|
+ if (tagName.isPresent()) {
|
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
+ }
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
|
+ if (startTs.isPresent()) {
|
|
|
url = url + "&startTs=" + startTs.get();
|
|
|
- if (endTs.isPresent())
|
|
|
+ }
|
|
|
+ if (endTs.isPresent()) {
|
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
- if (interval.isPresent())
|
|
|
+ }
|
|
|
+ if (interval.isPresent()) {
|
|
|
url = url + "&interval=60" ;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|